Home » Other » Client Tools » how to call a procedure/cursor
how to call a procedure/cursor [message #297972] Mon, 04 February 2008 06:30 Go to next message
bpm12
Messages: 3
Registered: February 2008
Junior Member
declare
cursor backup_duration
is
select *
from oracle_backup_schedule
where time+duration>=3.5 and time<=4.5;
begin
for backup_duration_rec in backup_duration loop
dbms_output.put_line('status is ' || backup_duration_rec.database_name || ' which is ' || backup_duration_rec.type || ' runs at ' || backup_duration_rec.time || ' on ' || backup_duration_rec.day || ' lasts ' || backup_duration_rec.duration);
end loop;
end;

hi guys, im at the early stages of using pl/sql
anyone know how i would call this procedure above using toad?
thanks
Smile
Re: how to call a procedure/cursor [message #297973 is a reply to message #297972] Mon, 04 February 2008 06:32 Go to previous messageGo to next message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
This is not a procedure as such. It is an anonymous block, you would simply enter it into a code window and then execute it.
You should probably have a look at the PL/SQL documentation here
Re: how to call a procedure/cursor [message #297974 is a reply to message #297973] Mon, 04 February 2008 06:39 Go to previous messageGo to next message
bpm12
Messages: 3
Registered: February 2008
Junior Member
okay thanks
Re: how to call a procedure/cursor [message #297977 is a reply to message #297974] Mon, 04 February 2008 06:46 Go to previous messageGo to next message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
Good luck, happy reading Smile
Re: how to call a procedure/cursor [message #297984 is a reply to message #297972] Mon, 04 February 2008 07:32 Go to previous messageGo to next message
raj1222
Messages: 5
Registered: February 2008
Location: hyd
Junior Member
to invoke or execute a procedure
use execute command and procedure name
exec <procedure_name)(parameters);
Re: how to call a procedure/cursor [message #297985 is a reply to message #297984] Mon, 04 February 2008 07:35 Go to previous messageGo to next message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
This does not answer the OPs actual question. It would appear that you read the question title and didn't bother to read the body of the question.
Re: how to call a procedure/cursor [message #298004 is a reply to message #297972] Mon, 04 February 2008 09:17 Go to previous messageGo to next message
bpm12
Messages: 3
Registered: February 2008
Junior Member
thanks pablolee
the documentation you sent me was very helpful

declare
v_number number;
begin
select 5
into v_number
from dual;
remove_backup(v_number);
end;
Re: how to call a procedure/cursor [message #298008 is a reply to message #298004] Mon, 04 February 2008 09:38 Go to previous messageGo to next message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
Glad you found it helpful.
Another worthwhile read is The ORAFAQ Guidelines These will show you how to format your posts when you ask /answer questions, to make it easier to read for all concerned.
See you on the forums
Re: how to call a procedure/cursor [message #298010 is a reply to message #298004] Mon, 04 February 2008 09:40 Go to previous message
Frank
Messages: 7901
Registered: March 2000
Senior Member
bpm12 wrote on Mon, 04 February 2008 16:17
declare
v_number number;
begin
select 5
into v_number
from dual;


Don't do that. Don't use SQL if there is no need:

declare
  v_number number;
begin
  v_number := 5;

or even
declare
  v_number number := 5;
begin
  ...

[Updated on: Mon, 04 February 2008 09:41]

Report message to a moderator

Previous Topic: Oracle client
Next Topic: popup
Goto Forum:
  


Current Time: Tue Apr 16 16:23:08 CDT 2024