PRO*C Execution time of Query

149 Views Asked by At

I am new to PRO*C and when i execute a query, basic question comes on my mind is, how to get the Execution time?

The option that comes on my mind to print the TIMESTAMP before and AFTER of Query. but, there will definitely be a better option than this, which i might have missed.

Example:

printf("BEFORE %s", ctime(&my_time)); 

EXEC SQL SELECT dname, deptno 
FROM dept 
WHERE deptno IN (SELECT deptno FROM emp); 

printf("AFTER %s", ctime(&my_time)); 

Does PRO*C has any inbuilt option to get the Execution Time of the Query? I tried a lot but i was not able to get information related to it.

1

There are 1 best solutions below

0
Prashant.jha On

There is a simple way of Finding the Execution Time of QUERY. HERE IS THE QUERY

DECLARE
  curr_time1 DATE := SYSDATE;
  curr_time2 NUMBER := dbms_utility.get_time;
  L_VAR VARCHAR2(2);
BEGIN
  SELECT 1 INTO L_VAR FROM DUAL;
  dbms_output.put_Line ('Elapsed Time = '||(dbms_utility.get_time - curr_time2));
END;
/