Link to home
Start Free TrialLog in
Avatar of jsaravana
jsaravana

asked on

Using stored procedure return value in batch file

Hi,

The below procedure returns the count of rows in a table. I need to call this Sprocedure from batch file. I need to use the value returned from the procedure in the batch file.

CREATE PROCEDURE get_count()
LANGUAGE SQL
P1:BEGIN ATOMIC
DECLARE CNT INTEGER;
select count(*) into CNT from administrator.test_title;
RETURN CNT;
END P1
@

Please give a solution for this. Thanks!.
Avatar of jsaravana
jsaravana

ASKER

Hi experts,

Could anybody please address this post.
SOLUTION
Avatar of tangchunfeng
tangchunfeng

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks..
Both the logic was helpful for me to find the count. I wanted to call the stored procedure from windows batch file so grep would not have worked. As returning is not possible I stored the count of rows in a file. Then used 'find' and 'fc' command of batch.
Ahh...

Windows batch scripting was tagged.  We all missed that part.

Apologies,
Kent