Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: print table name and the number of rows in it
I do this job with a Stored Procedure:
CREATE OR REPLACE FUNCTION Get_Row_Num(
p_table_name VARCHAR2
)
RETURN NUMBER
IS
v_return NUMBER; v_sql VARCHAR2(400);
BEGIN v_sql := 'SELECT COUNT(*) FROM ' || p_table_name;
EXECUTE IMMEDIATE v_sql INTO v_return;
RETURN v_return;
END Get_Row_Num;
/
SELECT
TABLE_NAME,
Get_Row_Num(TABLE_NAME) ROW_COUNT,
num_rows
FROM USER_TABLES
The results are different sometimes.
But why? For me it looks like the stored
procedure returns the correct result.
Björn
Arto Viitanen wrote:
> Sreelal wrote:
>
>> i want to print all the tables names owned by a user along with their >> number of rows... >> >> give me query >> thankz >>
![]() |
![]() |