Quantcast
Viewing all articles
Browse latest Browse all 3719

Data Services sql() statement with parameterize database and table

Hello,

Currently we use Data Services scripts to document the job and workflow status in a database table. Because we use these scripts in a lot of workflows and jobs and scripts are not reusable, we want to parameterize the statements in a function.

The problem is, that we use different datastores/databases. So there are some jobs with the database A and the status table A and some jobs with the datastore B and the status table B or whatever.

Now we tried to parameterize the SQL-Statement like this:

sql($Database,'SELECT JOB FROM '|| $Table ||' WHERE rtrim(WF) IS NULL AND rtrim(JOB)=\'' || job_name( ) || '\';') IS NULL

 

The result is that we get an error. The error says that I have to parenthesize the datastore in single quote. If I parenthesize the variable in single quote I get the message, that the database $Database is unknown.

Is there any solution to use parameter in a SQL statement? If it is not possible I want to ask if someone has an idea for a workaround.

 

Thanks,

Severin


Viewing all articles
Browse latest Browse all 3719

Trending Articles