Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to time a SQL script and return the time in a variable
On Mon, 05 Apr 1999 15:52:02 -0400, Joe Condle
<condle_at_mars-systems.com> wrote:
On Mon, 05 Apr 1999 15:52:02 -0400, in
comp.databases.oracle.misc you wrote:
>When using a PL/SQL block
>in sqlplus how are variable passed.?
Use the SQL*Plus VARIABLE command to declare a bind variable. You should be able to do something like this:
variable start_time varchar2(8)
variable end_time varchar2(8)
begin
--note the colon that must preceed start_time :start_time := to_char(sysdate,'hh:mi:ss');end;
...place your sql script here
begin
--Now you may reference start_time from --this block as well, because it's a SQL*Plus --mind variable. :end_time := to_char(... --Do something heer to calculate the elapsed timeend;
SQL*Plus bind variables cannot be type date, so you need to use either varchar2 or number. You should still be able to make that work though.
Jonathan Received on Tue Apr 06 1999 - 12:46:27 CDT
![]() |
![]() |