Stored Procedure Activity procedure parameter with int data type in Azure Data Factory - stored-procedures

I am working on a stored procedure activity to load data into one of my table. The procedure expects an int parameter to be passed and the value for this comes from the lookup output firstrow field. But when I pass the lookup output value for the parameter the pipeline is not getting executed. I have tried to convert the values as well and even used a variable to store. Any option to process the same?
Regards,
Sandeep

Can you send the detailed error when you try to execute the pipeline?
Thanks,
Pratik

Related

Stored Procedure to take json string as an input then insert these string into SQL table as output in Azure Data Factory

Continuing from my previous post:
Azure Data Factory Get Metadata to get blob filenames and transfer them to Azure SQL database table
I am trying to write a stored procedure to take json string as input and insert this string into SQL table as an output in Azure Data Factory. This is the Stored Procedure activity in my Azure Data Factory. I already wrote and save the begging of my stored procedure which is in Azure SQL server.
Here is the beginning of my Stored procedure:
I got some ideas from this post: Creating a stored procedure which ingests data after reading a JSON string
Here is my sample output.json file that I got it from the previous activity, Get Metadata of my pipeline. I basically need to get the value of itemName in this json file as an input of the stored procedure.
Could you please help me how to continue this stored procedure? Thank you very much in advance.
If I were you I could have read the output of the metadata as below and I passed those to the proc parameter .
#activity('Get Metadata1').output.durationInQueue.integrationRuntimeQueue
#activity('Get Metadata1').itemName
#activity('Get Metadata1').itemType
#activity('Get Metadata1').effectiveIntegrationRuntime
The proc should something like
CREATE PROC XXXXX
#effectiveIntegrationRuntime int
,#itemName varchar(100)
,#itemType varchar(100)
,Metadata1').effectiveIntegrationRuntime int
AS
INSERT INTO SOMETABLEXXX VALUES (#effectiveIntegrationRuntime .......)

Running stored procedure with out parameter and saving out value to variable in sqlworkbench/j script

How do I save procedure out parameter value to variable for later reuse in sqlworkbench/j script?
It is possible to run a stored procedure with out parameters using WbCall
However, the result of that can not be used to be stored into a Workbench variable.
That is only possible with "regular" queries (SELECT) that return a result set.

Passing parameters to stored procedure in OBIEE 12c rpd from OBIEE 12c dashboard

I am trying to create an OBIEE report using stored procedures.
I have created a function in SQL Developer which takes a parameter and returns refCursor as output.
I, then, set the following query as default initialization string in physical layer of rpd:
Select * from table(pipelined_emp(HR_DATA.GETCURSORS(parameter)))
GETCURSORS(parameter) is my function.
For now, in place of parameter, I am passing a constant value.
While, I wish to pass a value from the OBIEE dashboard, similar to a prompt, to this function in the physical layer of rpd.
Thanks!
Yes. Session variables in the RPD being written into by front-end request variables: https://gerardnico.com/wiki/dat/obiee/obis/request_variable

DB2 calling stored Procedure in conditional statement

I need to query a stored procedure and on the basis of result set of that procedure need to make decisions in conditional statement
For instance I have a stored Procedure "Main_SP"
Now if result of "Main_SP" is 'null' then the result should be 'Tweety', but if th result set is not null then result set should be retrieved,
how to do it?
I tried following and some other but none worked.
SELECT
case Main_SP('MyVariable')
when 'null'
then 'Tweety' end
FROM SYSIBM.SYSDUMMY1 WITH UR
SELECT
case Main_SP('MyVariable')
when null
then 'Tweety' end
FROM SYSIBM.SYSDUMMY1 WITH UR
It is failing the condition, In first command when even it is 'null' it is not printing 'Tweety'.
and while using second, Getting error that 'Null' is not valid in the context.
I don't believe you can use a stored procedure that way.
A stored procedure can return data in two ways
As a result set
in an output or input/output parm
You're not using option 2 and I don't think a result set is ever NULL. There might be no records, but the RS itself isn't NULL. In addition, from what I can see in the manuals, processing a RS from a stored proc inside another stored proc in DB2 requires you to declare an allocate result set locators. But I've never done this.
If your procedure returns a single value or null, you'd be better served by defining it as a function with a return value. Then your code would be simply:
SELECT
COALESCE(Main_Fnc('MyVariable'),'Tweety')
FROM
SYSIBM.SYSDUMMY1 WITH UR
You can't call a stored procedure as part of an SQL fullselect; you would need to have the client that calls the stored procedure handle this logic. If you must do it on the server, implement a new stored procedure that calls Main_SP itself and contains your logic to interpret the result.

Capability error while binding delphi grid wirth stored procedure

I am getting capability error whenever I am trying to set active property tue. I want to bind the grid with the stored procedure that takes one parameter.
If I do it through TQuery How do I specify the fields. I am using wwDBGrid.
MessageMembershipSelectQuery.Params[0].AsString :=
custQuery.FieldByName('cust_code').AsString;
MessageMembershipSelectQuery.Active := True;
Please guide
Replace you Query component by a StoredProc component. Also, check your parameter data type. If it is indeed a string parameter, then it´s Ok to use AsString, but if the parameter has a different data type, like Integer, for instance, then you should assign it´s value by using, for instance, AsInteger.

Resources