How can I run a committed sql-statement (as a parameter) in a procedure and get the e |
I'd want to build a PL/SQL function using a SQL-statement as a parameter. The statement may be DDL, DML, or DCL.
In the console, I want to print the time from the executed statement. I've got the following code: Code: create or replace procedure measureTime (statement IN varchar2 )AS I saw an article that says to modify systimestamp - l_start_time to trunc((systimestamp - l_start_time) * 24 * 60 * 60) in seconds. But I'm looking forward to a more straightforward method. However, it does not work. What's the problem?
The issue with your PL/SQL code seems to be that you have not declared the variable l_start_time in your code, which is being used in the expression systimestamp - l_start_time.
To fix this error, you can declare the variable l_start_time and set its value to systimestamp before executing the SQL statement. Then, you can calculate the elapsed time by subtracting l_start_time from systimestamp and convert it to seconds using the EXTRACT function. |
Welcome Guest, Not a member yet? Register Sign In |