SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
DatabaseRetrieve

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
DatabaseRetrieve
Author Message
Gennadiy Shender



Joined: 29 Apr 2002
Posts: 2

Post DatabaseRetrieve Reply with quote

Hello,

My question is :
when I execute stored procedure in JAL script for example:

DatabaseRetrieve("execute sp_name",rows)
DatabaseSave("c:\\temp\\file_name.csv","CSV",rows )
....
DatabaseDisconnect

Based from the trace file and database audit table
It has been executed twice.

Is any particular problem(s) there?
How to avoid multiply execution for particular job at a time ?

Thanks,
Gennadiy


Mon Apr 29, 2002 1:48 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7948

Post Re: DatabaseRetrieve Reply with quote

You are correct, it is executed twice, first time to get the definition of the result set (DESCRIBE) and second time to fetch the data. Unfortunately this cannot be changed because the SQL is executed as (24x7 has no idea whether it executes a regular SELECT or a stored procedure (no SQL parsing and translation is performed)

There are two workarounds for this problem. If you can modify the stored procedure, make it to save results into some table so in the script you can do

DatabaseExecute "EXEC your_procedure_name_here", rows
DatabaseRetrieve "SELECT * FROM result_table", rows

If you cannot modify the original procedure here is another workaround:
Create your own procedure that will call the original procedure and save time of the result set in some 1 row table with a column for the system time. That second procedure logic could be like the following:

If the table has the time value which is more than a couple of seconds old, just return an empty result set matching by definition the result set of the original procedure and then update the time value, otherwise call the original procedure. If you need help with this procedure please let me know.

In the second approach you will NOT need to change original procedure and the only change in the job code is to use your own procedure name.

: Hello,

: My question is : when I execute stored procedure in JAL script for example:
: DatabaseRetrieve("execute sp_name",rows)
: DatabaseSave("c:\\temp\\file_name.csv","CSV",rows )
: ....
: DatabaseDisconnect

: Based from the trace file and database audit table
: It has been executed twice.

: Is any particular problem(s) there?
: How to avoid multiply execution for particular job at a time ?

: Thanks,
: Gennadiy

Mon Apr 29, 2002 3:24 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.