Home » SQL & PL/SQL » SQL & PL/SQL » error in where clause (Oracle, 10g, windows XP)
error in where clause [message #331360] Thu, 03 July 2008 02:17 Go to next message
jyothsna1612
Messages: 68
Registered: June 2008
Member
Hi,

create table emp1(nm varchar2(12), salary number)

declare
bon number;
ename varchar2(12);
begin
select salary*0.1 into bon
from emp1
where nm=&ename;
dbms_output.put_line(bon);
end;


It's giving error in TOAD
Though it's simple i'm unable to find why the error
Re: error in where clause [message #331361 is a reply to message #331360] Thu, 03 July 2008 02:19 Go to previous messageGo to next message
Michel Cadot
Messages: 68704
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Fix the error and you will no more have one.
Or better, don't use TOAD.

Regards
Michel

[Updated on: Thu, 03 July 2008 02:20]

Report message to a moderator

Re: error in where clause [message #331362 is a reply to message #331360] Thu, 03 July 2008 02:21 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
It might help us help you if you'd tell us which error you got..
Re: error in where clause [message #331364 is a reply to message #331360] Thu, 03 July 2008 02:27 Go to previous messageGo to next message
jyothsna1612
Messages: 68
Registered: June 2008
Member
Yes

I got the output.
I tried the where clause like this:
where nm='&ename';


Thank you very much
Re: error in where clause [message #331503 is a reply to message #331360] Thu, 03 July 2008 12:28 Go to previous messageGo to next message
espbcn
Messages: 3
Registered: May 2008
Location: Baracelona
Junior Member
Hi,

You do not need to use ';' in TOAD to terminate the statement.

Cheers,
Paul

[Updated on: Thu, 03 July 2008 14:07]

Report message to a moderator

Re: error in where clause [message #331827 is a reply to message #331360] Sat, 05 July 2008 15:50 Go to previous messageGo to next message
raveendra
Messages: 1
Registered: July 2008
Location: Hyderabad
Junior Member
Pitchidana,
without using single quotes('') for a sting value, how it works...
Re: error in where clause [message #331831 is a reply to message #331827] Sat, 05 July 2008 16:23 Go to previous messageGo to next message
Littlefoot
Messages: 21821
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Q:
without using single quotes('') for a sting value, how it works...

A:
It's giving error
Re: error in where clause [message #332193 is a reply to message #331360] Mon, 07 July 2008 16:18 Go to previous message
mad_bu
Messages: 8
Registered: August 2006
Junior Member
Hi jyothsna1612

you can try this in Toad.

EXAMPLE :

create table autoqa.emp1(nm varchar2(12), salary number);

Table Created.

insert into autoqa.emp1 values('TEST',100);

1 row Created.


declare
bon number;
ename varchar2(12);
begin
select salary*0.1 into bon
from emp1
where nm=&ename;
dbms_output.put_line(bon);
end;
/
Enter value for ename: 'TEST'
old 7: where nm=&ename;
new 7: where nm='TEST';
10
PL/SQL procedure successfully completed.

-mad_bu.

[Updated on: Mon, 07 July 2008 16:58]

Report message to a moderator

Previous Topic: Dynamic SQL and Unicode
Next Topic: Order by Case and Union All
Goto Forum:
  


Current Time: Mon Nov 04 06:15:26 CST 2024