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

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

Related

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

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

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.

How to access document directly through ComsoDB stored procedure

In my stored procedures I often have to access another document, and currently do a query e.g. var query = 'SELECT * from foo f where f.id = "bar"';
I know this will always return 1 result, so is there a way I can access the document directly by id without having to do a query?
You can call a document directly through the REST API with the following URL when using SQL(Core):
https://{databaseaccount}.documents.azure.com/dbs/{db-id}/colls/{coll-id}/docs/{doc-id}
More information about this interface can be found here: Get a Document
Is this what you are looking for?
I know this will always return 1 result, so is there a way I can
access the document directly by id without having to do a query?
Per my knowledge, there is no such method to get document directly without doing a query in stored procedure.
If you want to access the document which is fixed, you could fully pass it into the stored procedure as a json string parameter, without doing a redundant query.
If the accessed document is flexible, you need to query by it's id or it's _self property.

How to specify a parameter as collection in Commandtext

I am using SqlCommandProvider and I need to get some data for each id in an id collection
let ids=["B058A99-C4B2-4CC3-BA9F-034B1F1ECCBD";"A09C01C-D51B-41C1-B44C-0995DD285088"]
[<Literal>]
let qLogo ="""SELECT Id,LogoUrl FROM Hotels WHERE Id IN (#IDS)"""
let queryLogo = new SqlCommandProvider<qLogo,constring>()
queryLogo .Execute(ids)//i need to be able to pass a collection here
`
Long story short, SqlCommandProvider is not even correct type provider to do this (assuming you don't consider string concatenation to build query). The reason is SQL Server only accepts array parameters through calling stored procedure and passing a Table Valued Parameter.
So, to call a stored procedure you need an SqlProgrammabilityProvider to achieve this. But you'll have to create Table Type and Stored Procedure up-front, as described in type provider documentation (scroll down to "Table-valued parameters (TVPs)" section).
Relevant discussion: How to use SQL IN statement in fsharp.data.sqlclient?

how do i execute a stored procedure with vici coolstorage?

I'm building an app around Vici Coolstorage (asp.net version). I have my classes created and mapped to my database tables and can pull a list of all records fine.
I've written a stored procedure where the query jumps across databases that aren't mapped with Coolstorage, however, the fields in the query result map directly to one of my classes. The procedure takes 1 parameter.
so 2 questions here:
how do i execute the stored procedure? i'm doing this
CSParameterCollection collection = new CSParameterCollection();
collection.Add("#id", id);
var result = Vici.CoolStorage.CSDatabase.RunQuery("procedurename", collection);
and getting the exception "Incorrect syntax near 'procedurename'." (i'm guessing this is because it's trying to execute it as text rather than a procedure?)
and also, since the class representing my table is defined as abstract, how do i specify that result should create a list of MyTable objects instead of generic or dynamic or whatever objects? if i try
Vici.CoolStorage.CSDatabase.RunQuery<MyTable>(...)
the compiler yells at me for it being an abstract class.
There's a shortcut in CoolStorage to run a stored procedure. Simply prefix the stored procedure name with "!":
CSDatabase.RunQuery("!procedurename", collection);

Resources