cancel
Showing results for 
Search instead for 
Did you mean: 

Getting the row count for dynamically specified table in a procedure

Srisap
Participant
0 Kudos

I have the following code in my procedure:

EXEC 'SELECT COUNT(*) INTO'|| V_CNT ||'FROM'|| :V_TBLNAM_IN;

:V_TBLNAM_IN is a dynamically specified table name.

I get the following error:

Could not execute 'CALL "xxx"."xxxxx"( '"TABLE_A"')' in 179 ms 917 µs .

SAP DBTech JDBC: [2048]: column store error: search table error:  [2620] "xxx"."xxxxx": line 10 col 1 (at pos 240): [105] (range 1) NullConversion exception

When the code is compiled no error.

Any help would be appreciated.

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

former_member182302
Active Contributor
0 Kudos

Hi Sridhar,

Have a look on this thread: Procedure to get no of records from any table | SCN

Regards,

Krishna Tangudu

Srisap
Participant
0 Kudos

Krishna,

You code did the trick. But how does M_TABLES gets updated with the record count?


Wouldn't it be advisable to get the record count from the table itself rather than M_TABLES?

Thanks.

Former Member
0 Kudos

M_TABLES is system view (not table) which has all the details regarding HANA tables (fetching data from system tables.

Regards,

Gourav

Answers (0)