Home » SQL & PL/SQL » SQL & PL/SQL » SQL QUERY - please (merged)
icon10.gif  SQL QUERY - please (merged) [message #305169] Sun, 09 March 2008 22:52 Go to next message
rolmau
Messages: 18
Registered: March 2008
Location: UK
Junior Member

Hi to everybody
I am using oracle 10g running from windows xp
I getting some error from my programme may someone will help please
here my progmm
I created my table products
create table products(
prod_no varchar2(10),
name varchar2(10),
v_cost number,
cost varchar2(10));

when I run this programm
declare
v_cost number;
p_name varchar2(30);
price number(6,2);
vat number(6,2);
total number(6,2);

begin
p_name :='Toshiba DVD Player'
select cost, into v_cost
from products
where name=p_name;

price :=v_cost *1.5;
vat :=price*0.175;
total:=price+vat;

DBMS_OUTPUT.PUT_LINE(name||':');
DBMS_OUTPUT.PUT_LINE('Cost:£'||v_cost);
DBMS_OUTPUT.PUT_LINE('Price:£'||price);
DBMS_OUTPUT.PUT_LINE('VAT:£'||vat);
DBMS_OUTPUT.PUT_LINE('Total:£'||total);
end;
/

getting this error


select cost, into v_cost
*
ERROR at line 10:
ORA-06550: line 10, column 2:
PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
* & = - + ; < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
LIKE4_ LIKEC_ between || multiset member SUBMULTISET_
I DO NOT WHAT DOES IT MEAN
Re: SQL QUERY - please [message #305174 is a reply to message #305169] Mon, 10 March 2008 00:00 Go to previous messageGo to next message
powerls
Messages: 11
Registered: February 2006
Junior Member
select cost, into v_cost
from products
where name=p_name;

in this query remove the , after cost column.

that is the error.

Re: SQL QUERY - please [message #305186 is a reply to message #305169] Mon, 10 March 2008 01:23 Go to previous messageGo to next message
Michel Cadot
Messages: 68718
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
@rolmau

Don't hijack another one's topic, create your own.
Also please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter).
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).

Regards
Michel
Re: SQL QUERY - please [message #305339 is a reply to message #305169] Mon, 10 March 2008 08:28 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
You need a semicolon to end every line in SQL. Your previous line is missing it.
the same sound from my progrmme [message #305473 is a reply to message #305169] Mon, 10 March 2008 22:22 Go to previous messageGo to next message
rolmau
Messages: 18
Registered: March 2008
Location: UK
Junior Member

Hi powerls
Hi joy_division


I did what you said but getting now the same error just after putting the value from ENTER VALUE FOR V_COST:

Enter value for v_cost: 3
old 10: select cost & v_cost
new 10: select cost 3
select cost 3
*
ERROR at line 10:
ORA-06550: line 10, column 2:
PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
* & = - + ; < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
LIKE4_ LIKEC_ between || multiset member SUBMULTISET_

Thanks again
Re: the same sound from my progrmme [message #305474 is a reply to message #305473] Mon, 10 March 2008 22:56 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
What does the title of the post have to do with anything in your post?

It would help everyone, including YOU, if you read & followed the posting guidelines as stated below:

http://www.orafaq.com/forum/t/88153/0/

Before posting another problem, please try to RTFM as follows:
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/toc.htm
Re: the same sound from my progrmme [message #305649 is a reply to message #305473] Tue, 11 March 2008 08:13 Go to previous message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
Posting pieces of code is useless. How do we know what you changed, what you ran or your real error.
Please read the guidelines of the forum and post your full session, not a reasonable facsimile.
And please post formatted code.
Previous Topic: PL/SQL
Next Topic: how to modify the view
Goto Forum:
  


Current Time: Sun Dec 01 12:26:56 CST 2024