We have one use case where we are looking for a feature of looping the records and reading it record by record .. Can you please share any template plan for the same..
Hi
I’d be happy to suggest a solution once I can understand this a little more.
Thanks
Here is the use case :
Below is the table details that we are using :
Record Numbers :: Grp_Name :: sql_query
Record no = 1 | ‘DQ1’ | ‘select count(1) from tab1;’
Record no = 2 | ‘DQ1’ | ‘select count(1) from tab2;’
We want to loop through the records t record by record ] and execute the query present in each row tsql_query] output the results into another table :
Below is the output that we have expecting in the result table :
Record Numbers :: Grp_Name :: sql_results
Record no = 1 | ‘DQ1’ | ‘200’
Record no = 2 | ‘DQ1’ | ‘300’
To summarize.. we are looking for a looping mechanism < record by record ] and output the results into another table .
If you have any template or a sample plan, can you please share ..
Regards,
Srikanth Gurram
Dear Srikanth,
Unfortunately we don't have any templates or sample plans containing steps and procedures you are looking for. Your request will require billed effort from our professional services team in order to come up with the custom solution. Having said that, we tried to get some general guidance and expert opinion regarding your request and would like to share with you the opinion of one of our manager consultants regarding the use of SQL Execute / SQL Select in your use case. The use of SQL Execute is not likely as it doesn't return the dataset. It will have to be parameterized SQL Select step. Regarding this example: Record no = 1 | ‘DQ1’ | ‘select count(1) from tab1;’ Record no = 2 | ‘DQ1’ | ‘select count(1) from tab2;’ If it's really just about the tab1 and tab2 parameterization, it could work but we will have to test this.
Thanks and regards,
You could write a stored procedure with a little bit of dynamic code to loop the queries with a cursor. Execute this from a workflow which contains the rest of the plans to execute. Would you know how to do this?
But some important info: Is the output of the queries always the same? If not you need a bit more complex code in the stored procedure, namely a pivot.
We have a sample plan (v13.7) for you, if you are interested. I see no way to share.
Hi
I have enabled file upload/attachments. You should now be able to upload using the paperclip icon.
See Iterating rows of a table (Record-by-record - SQL Iterator) in a workflow | Community (ataccama.com)
Executing dynamic queries is another post you can find on the community.
Reply
Login to the Ataccama Community
No account yet? Create an account
For Ataccama Customers and Partners
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.