I have written a Stored proc which calculates size of a table.
create or replace PROCEDURE RETRIEVE_TABLE_SIZE (
p_segment_type in VARCHAR2,
p_segment_name in VARCHAR2,
P_table_size out INTEGER )
AS
BEGIN
SELECT bytes/(1048576*1024) as GB FROM DBA_SEGMENTS WHERE SEGMENT_NAME = p_segment_type AND SEGMENT_TYPE = p_segment_name ;
END ;
I am calling this Stored proc from my java class and my code is below
String sqlQuery = "{call RETRIEVE_TABLE_SIZE(?,?,?)}";
CallableStatement callableStatement = connection.prepareCall(sqlQuery);
callableStatement.setString("p_segment_type","TABLE");
callableStatement.setString("p_segment_name","SIM_HEADER");
callableStatement.registerOutParameter("P_table_size",java.sql.Types.INTEGER);
callableStatement.executeUpdate();
Integer size = callableStatement.getInt(1);
System.out.println("size is: "+size);
But I am getting error given below:
Exception in thread "main" java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00201: identifier 'RETRIEVE_TABLE_SIZE' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
This is first time I am writing Stored Proc. Please rectify me if I am doing something wrong.