How to pass table as a input parameter in function? - monetdb

Is it possible to pass table as input parameter in Monetdb function/procedure?
I tried prepare statement but was not able to get it working.
Also it would be nice to get statementid returned directly by 'prepare' statement rather then query sys.prepared_statements

No, you cannot pass (table) identifiers to functions/procedures.
You could use this trick, but I wouldn't recommend it for production use.

Related

Call stored procedure with query annotation and subsequently run query on result

I have a stored procedure in the database, this stored procedure returns a table with the columns deviceId, operatorId, serialNumber, status, tailId, lastCheckIn, lastDownload, filename. Really what I want to do is to grab from the result, all the instances that have a deviceId, that is contained in a list that is defined on the side. There are 2 ways I came up to solve this.
The first one, which is the one that is the most straightforward to me is using the #query annotation, and running another query on the resultant table of that stored procedure. Thing is, the examples that I found online are more inclined towards passing in parameters to the stored procedure, instead of running a query with the results of it. I just want to know if my first idea is valid and how to execute it if so. The second one is to pass in the list as a parameter, but not exactly sure how to manipulate it in the stored procedure or if it's able to interpret this structures at all.
The list that I want to compare to the deviceId columns is of type <List<UUID>>. And to give more context on my enviroment, I'm working with Azure SQL DB's.
Thanks.

User-Defined Function Nested in Macro - Framework Manager

We are trying to create a dynamic query subject filter. To do this, we are trying to nest an Oracle user-defined function inside of a macro.
Example query subject filter:
#strip(ORACLE_USER_DEFINED_FUNCTION())#
We have imported the oracle function ORACLE_USER_DEFINED_FUNCTION into Framework Manager. The function returns a VARCHAR2 of the desired expression. For testing purposes, this function is simply returning VARCHAR2 value of '1=1' (the single quotes are not part of the VARCHAR2 return value).
The idea being that we want the query subject filter expression to be dynamically generated at run-time so the resulting query contains '...WHERE 1=1'. The strip macro is the mechanism to pre-process and invoke the user-defined function before the query is sent to the database.
However, when attempting to verify/check the query subject filter we receive the following error.
XQE-GEN-0018 Query Service internal error has occurred, please see the log for details.
I'm trying to get a hold of the query service log, but don't yet have it.
Perhaps there is some casting needed to convert the oracle VARCHAR2 output from the function to an IBM/Cognos string that is acceptable input for the IBM/Cognos macro.
Your assistance is appreciated. Thanks in advance.
Using Oracle 12c and Cognos 11.1.
With the exception of the queryValue macro function, macros are evaluated prior to accessing the database. This means the macro does not know what the Oracle UDF is or what its supposed to do. If you are able to call the UDF via a FM query subject you maybe able to get away with something similar to the queryValue answer found here:
Cognos 11.1.7 Framework manager change the table for the query subject, type data

How to use variable in the query using azure data factory?

I'm trying to use the trigger_start_time variable in the query as the 2nd parameter to a function of lookup activity.
How can I do this ? Can anyone please help me out ?
Please try #concat('select schema.fn_up_watermark(',Parameter_name,',',variable_name, ') from dual') in add dynamic content.
I just make this example with the query you provide me. You could test that not use the parameter and variable to check where missing the right parentheses.
Now, I'm glad to hear the issue is resolved now.
You can do away with the variable and simply write:
select schema.fn_up_watermark('#{item().table_name}','#{pipeline().TriggerTime}') from dual
assuming both parameters are string.
You could still do SQL injection if you can affect the outer lookup that feeds this ForEach block - you could sanitise the table_names on entering this loop possibly.

I am working on BIRT reporting

Is that possible to get multiple parameter values based on another parameter value. For example if I select facility id ,then it should populate below region and FQA parameters.
I think you want to use cascading parameters. Check out this URL to see if it is close to what you are aiming for... https://www.eclipse.org/forums/index.php/t/503715/
What you need is a cascading parameter group. Here is an example video on how to use it.

How do I set an SSRS Parameter that doesn't have a value to something else?

I have an SSRs Report with a parameter that gets information from SQL. If it hasn't found anything, at the moment it is just empty. Is there anyway to set it such that if it's empty it will return a different value, say "Please Extend Date Ranges" and disable the parameter?
If you using it to fill it using the SQL and using it for only internal purposes then there is option to make the parameter internal and it will be hidden and it will does not prompt the user.
Make a change to the stored procedure or query that populates the parameter. Include some logic so that if no results are returned by the query you are using now, it adds a row with the default label you want.
But no, you can't disable the parameter dynamically, I don't believe.

Resources