NEED HELP IN SQL Oracle PL / SQL
2 posters
:: Support
Page 1 of 1
NEED HELP IN SQL Oracle PL / SQL
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 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 ?
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 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 ?
Re: NEED HELP IN SQL Oracle PL / SQL
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
- Posts : 145
Points $ : 774
Join date : 2011-12-04
Re: NEED HELP IN SQL Oracle PL / SQL
lol i get full mark on that test declarejhovarie 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.
update sis price='newprice';
it must be like this
update sis SET price=price*(10/100);
Re: NEED HELP IN SQL Oracle PL / SQL
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
- Posts : 145
Points $ : 774
Join date : 2011-12-04
Re: NEED HELP IN SQL Oracle PL / SQL
mySQL some program that you make it and do the jpb for you easy as that.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.
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.
:: Support
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|