Home » SQL & PL/SQL » SQL & PL/SQL » Hi - need help with if statement
Hi - need help with if statement [message #339891] Sat, 09 August 2008 08:53 Go to next message
levindi
Messages: 6
Registered: August 2008
Junior Member
Hi all,

I just started to learn procedures and if statement and it seems I need a little help,

I have this code until now:

declare v_delivery number;
v_item number;
v_quantity number;
v_qaunt_should number;
begin
insert_delivery_details(
v_delivery=>&enter_delivery_num,
v_item=>&which_item,
v_quantity=>&how_much);

v_quant_sould := select sapak_num from sapakin where sapak_name='miki'


if .......



I have problem with the bold line... is there a possible to put a value of a select statement in a variable ?
I tried in different ways without success.

the procedure and the code is working fine, I just didn't copy all just the until the part that make problem.

Thank you very much,
Dan
Re: Hi - need help with if statement [message #339894 is a reply to message #339891] Sat, 09 August 2008 08:57 Go to previous messageGo to next message
BlackSwan
Messages: 25042
Registered: January 2009
Location: SoCal
Senior Member
http://www.orafaq.com/forum/t/88153/0/
Please read & FOLLOW Posting Guidelines as stated in URL above.

Do you always learning programming by trial & error as opposed to actually RTFM where valid syntax is provided?


http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/toc.htm

The "INTO" clause is part of the answer/solution.
Re: Hi - need help with if statement [message #339898 is a reply to message #339894] Sat, 09 August 2008 09:10 Go to previous messageGo to next message
levindi
Messages: 6
Registered: August 2008
Junior Member
Sorry about my mass massage, I hope I will improved. please without anger.

I think I know the answer.
thanks

[Updated on: Sat, 09 August 2008 09:16]

Report message to a moderator

Re: Hi - need help with if statement [message #339899 is a reply to message #339891] Sat, 09 August 2008 09:17 Go to previous messageGo to next message
BlackSwan
Messages: 25042
Registered: January 2009
Location: SoCal
Senior Member
The solution should be posted here for others who have similar problem in the future.

By the way, I do not see any "IF" statement on this thread.

[Updated on: Sat, 09 August 2008 09:18] by Moderator

Report message to a moderator

Re: Hi - need help with if statement [message #339900 is a reply to message #339899] Sat, 09 August 2008 09:20 Go to previous message
levindi
Messages: 6
Registered: August 2008
Junior Member
you are right! I'm just learning Smile

I had a problem with the syntax

it should be written like this:

select sapak_num into v_quant_should from sapakim where sapak_name='miki';

select (column) into (variable) from (table)
Previous Topic: DISTINCT ROWNUM
Next Topic: raising an exception
Goto Forum:
  


Current Time: Wed Dec 07 04:59:52 CST 2016

Total time taken to generate the page: 0.07523 seconds