Would you like to react to this message? Create an account in a few clicks or log in to continue.

NEED HELP IN SQL Oracle PL / SQL

2 posters

 :: Support

Go down

NEED HELP IN SQL Oracle PL / SQL  Empty NEED HELP IN SQL Oracle PL / SQL

Post  lordvizer Fri Jan 13, 2012 1:19 pm

i make a table of a shop it have item ID [PID] and name and price
this is the code


create table sis(name varchar2(12),PID number(4),price number(5));
insert into sis values('vinx',101,500);
insert into sis values('revi',102,400);
insert into sis values('cove',103,150);
insert into sis values('zex',104,250);
desc sis;
select *from sis;
working

to change all the prices in the table -10% i make this PL

declare

price number(5);
PID number(4);
de number(4);
newprice number(4);
begin

for PID in 101..104 loop
de:=price*0.1;
newprice:=price-de;
update sis price='newprice';
end loop
End;
___________________________________
it is not working Sad i try too hard for it the error is

ORA-06550: line 12, column 17:
PL/SQL: ORA-00971: missing SET keyword
ORA-06550: line 12, column 1:
PL/SQL: SQL Statement ignored
ORA-06550: line 15, column 1:
PLS-00103: Encountered the symbol "END" when expecting one of the following:

;
The symbol ";" was substituted for "END" to continue.
1. declare
2. price number(5);
3. PID number(4);

________________________________________________
any one can help me with this ?
lordvizer
lordvizer
Loyal Member
Loyal Member

Posts : 357
Points $ : 2478
Join date : 2011-11-09
Age : 36
Location : Dubai

http://www.easyhits4u.com/customsplash/27074/

Back to top Go down

NEED HELP IN SQL Oracle PL / SQL  Empty Re: NEED HELP IN SQL Oracle PL / SQL

Post  jhovarie Wed Jan 18, 2012 3:18 am

try to copy paste the error message and search it in google search im doing this if i get error in my coding syntax.

jhovarie
Loyal Member
Loyal Member

Posts : 145
Points $ : 774
Join date : 2011-12-04

Back to top Go down

NEED HELP IN SQL Oracle PL / SQL  Empty Re: NEED HELP IN SQL Oracle PL / SQL

Post  lordvizer Wed Jan 18, 2012 9:51 am

jhovarie wrote:try to copy paste the error message and search it in google search im doing this if i get error in my coding syntax.
lol i get full mark on that test declare


update sis price='newprice';
it must be like this
update sis SET price=price*(10/100);
lordvizer
lordvizer
Loyal Member
Loyal Member

Posts : 357
Points $ : 2478
Join date : 2011-11-09
Age : 36
Location : Dubai

http://www.easyhits4u.com/customsplash/27074/

Back to top Go down

NEED HELP IN SQL Oracle PL / SQL  Empty Re: NEED HELP IN SQL Oracle PL / SQL

Post  jhovarie Wed Jan 18, 2012 3:49 pm

good for you resolve it. i never try to use oracle and sql tell me what is the advantage of sql to mysql? in oracle i know the advantage of that but in sql i dont know what is the advantage of sql from mysql.. iv been using mysql since i learn programming until now.

jhovarie
Loyal Member
Loyal Member

Posts : 145
Points $ : 774
Join date : 2011-12-04

Back to top Go down

NEED HELP IN SQL Oracle PL / SQL  Empty Re: NEED HELP IN SQL Oracle PL / SQL

Post  lordvizer Wed Jan 18, 2012 5:01 pm

jhovarie wrote:good for you resolve it. i never try to use oracle and sql tell me what is the advantage of sql to mysql? in oracle i know the advantage of that but in sql i dont know what is the advantage of sql from mysql.. iv been using mysql since i learn programming until now.
mySQL some program that you make it and do the jpb for you easy as that.
like you have a shop with 2500 item and you like to change the price of them all +\- some%
so with SQL you need to update each row each item with mysql you make small program that finish the job for you in 1 mint xD.
too much can be done by mysql like back up ,send the information to other table after insert or update or delete[use trigger],will i can't count them all because it's depend on what you need to do xD.
lordvizer
lordvizer
Loyal Member
Loyal Member

Posts : 357
Points $ : 2478
Join date : 2011-11-09
Age : 36
Location : Dubai

http://www.easyhits4u.com/customsplash/27074/

Back to top Go down

NEED HELP IN SQL Oracle PL / SQL  Empty Re: NEED HELP IN SQL Oracle PL / SQL

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top


 :: Support

 
Permissions in this forum:
You cannot reply to topics in this forum