adding parameters in stored procedure through excel in Oracle - stored-procedures

I have a stored procedure in oracle 11g containing three parameters.
Can I fetch the value of these three parameters from an excel file or any other file, eg: text file etc.
If so, then how can I do it.

You can create an sqlloader and load the values from the file into a temporary table. Then create a trigger, which fires on insert, calling the procedure with the inserted values.
Edit: Added info about sqlloader and triggers.
TL/DR. Create a control file, which contains the format of the input file, which basicly explains to the loader how to load the contents of the file into a given table. A tigger can call your procedure using the insert event.

Related

Call stored procedure based on parameter from data in Crystal report

I am trying to achieve the following scenario using crystal report:
Call stored procedure from SQL server using parameter that is set from data in each row of table in crystal report. See illustration in the figure below:
Each stored procedure for each row will be executed based on value that is passed to stored procedure.
I have been trying to call stored procedure using Database expert, and use the field for stored procedure the same as I use the field from Tables.
The problem is the report will always ask the value for the parameters, as this approach will generate parameter fields based on the parameter that is defined in stored procedure. I want the parameter values to be set automatically based on the data in each row.
Please let me know whether it is possible to achieve this scenario using crystal report. For the information, I don't have access to the source code that generate this report. So, I have to do this on report file.

derby procedure that does not modify

I'm trying to create a trigger on derby which simply calls a procedure. The stored procedure does not change anything and gets no parameters. It simply check that the time is within an interval (for example between 08:00 and 16:00). On creation of trigger i receive the following error:
"42Z9D: Procedures that modify SQL data are not allowed in BEFORE triggers."
But the procedure makes no changes.
When defining a procedure one should specify if the procedure modifies data or not. If it executes any sql or not. As mentioned in the link provided above by Bryan I should use one the options:
{ NO SQL | MODIFIES SQL DATA | CONTAINS SQL | READS SQL DATA }
If you dont use this options the default value will be assumed that is CONTAINS SQL.

Stored procedure not appearing in EF code

I'm using EF database first and have added a stored procedure to the database.
When I ran Update model from database on the edmx file it picked up the stored procedure and I selected it as an item I wanted to include.
I have a file named Model<projectname>.Context.cs with a class called Entities in it. This is an auto-generated class and it contains methods for other stored procedures in the system. My new stored procedure does not have a corresponding method in this class and running Run custom tool does not help.
Is there something else that I need to do, that I am not doing?
Thanks,
Sachin
EDMX doesn't support Table-valued parameter. So if your proc uses the TVP as the parameter, the EDMX designer can't pick it up.
Edited:
If you want to retrieve the result set and create object/POCO for the proc, then just simply remove the tvp, compile the proc, let the EDMX designer to pick up your proc, generate the result object and then add the tvp back to your proc. This is a very easy way to cheat the EDMX designer and get what you need.
Ensure you are doing "Run Custom Tool" on the *Model.CONTEXT.tt file.

ADODataset: how to load XML (saved beforehand in DB in ADO schema) data without temporary files?

Warning: total rewrite.
Scenario:
I loaded some data from database on a TCustomADODataset descendant. After that, I saved this data on XML temp file (using TCustomADODataset.SaveToFile) to allow getting the XML data as a string and store it on a database table as text blob - it's an exports table.
Another program (different from the one that stored the XML) will take that data, show the elements inside, and allow an user to select which element to import to the main database schema.
Problem:
The problem with the approach above is the need of temporary files to allow TCustomADODataset use the LoadFromFile method.
There's any other way to load that XML data stored as text in the database exports table into a TCustomADODataset that don't need temporary files?
Notes:
TClientDataset is not an option in this case.
Check this example. It is probably exactly what you are looking for. Using the RecordsetFromXML from that example you can simply assign the recordset to your TCustomADODataSet.Recordset property.

How i can put a result set from a stored procedure in a temporary table in DB2

The title is very descriptive i think... My scenario is the next. I need to put the result of a result set (for example a result set with 6 columns and variable rows) from a stored procedure in some temporary table to make some operations over this new table.
I find some examples in the web but nothing in DB2...
The big problem is how to populate that new table with the restult set of a called stored procedure
DECLARE GLOBAL TEMPORARY TABLE probably accomplishes what you want. You can create this type of temporary table inside a stored procedure. It is visible only to the current session and is cleaned up for you when the session ends.

Resources