cfquery oracle stored procedure - oracle

I had to change the SQL stored procedure to ORacle stored procddure.I am able to successfully execute my modified stored procedure in oracle.
But unable to obtain the query result in CF for the Oracle stored-Procedure.I have used <cfquery>.
Any suggestions or tips to for using an Oracle stored proc/CF-8?

Think you need cfstoredproc, not cfquery.
See manual page for more details.

It does really depend on how it reacts, i'd test your stored proc in oracle sql+plus first, to make sure it returns data, then try it via cfquery or stored procedure...

Related

What is the equivalent oracle code for CREATE PROCEDURE <Proc1> WITH RECOMPILE which is available in Sybase ASE/SQL Server

This is what I see from Sybase ASE documentation:
"It instructs Adaptive Server not to save a plan for this procedure. A new plan is created each time the procedure is executed."
So this means ASE does plan the stored procedure code in order to execute it, but what about oracle? Does Oracle saves plan at stored procedure level?
Oracle does not save plans at the stored procedure level.
Oracle stores SQL plan information in a memory structure called the shared pool, which is part of the System Global Area (SGA). Plans will be modified and created when necessary, based on when the queries are executed. With the default settings, the plans will automatically adjust based on things like data and bind value changes. You don't need to worry about plans changing or not changing when compiling objects.

Oracle Stored Procedure is not working in SSRS Query Designer

I wrote a stored procedure in Oracle 11g. It has 4 input parameters and 60 output parameters. It executes successfully and returns output using GUI in Oracle SQL developer tool.
But problem is in SSRS I connect with Oracle as ODP.NET Data Source. Test connection succeeds in shared data set properties.
When I select the specific stored procedure and pass 4 input parameters which are VARCHAR2 Data types
it shows an error:
You have to use the output parameters as well when you call the procedure.
PS: I don't like the idea of having 60 output parameters. I'd use a record or a collection (or both).

call a sql function stored in a separate db server from a stored procedure

I have a SQL function stored in a db server and want to call it from a stored procedure in a separate sever.Is that possible? In case it is possible, please provide an example.
To call stored procedures/functions or simply call some sql queries from remote database you can use DATABASE LINKS. To create such database link you can call:
CREATE DATABASE LINK database.name.com
CONNECT TO scheme_you_want_to_connect_to IDENTIFIED BY password_to_the_scheme
USING service_name;
When you create database link, you should be able to call the procedures like this (assuming you have sufficient grants):
mySchema.myPackage.myProcedure('some', 'params', 'you', 'want', 'to', 'pass')#database.name.com
I'm sure you will find lots of other examples in the web.

Executing Stored proc from UDF

is it possible to execute a stored procedure inside a user defined function in Oracle 10g database?
If yes, could you please give en example?
Thanks.
Sure you can. See for example The last example in Oracle® Database SQL Reference
10g Release 1 (10.1) Create function
The example uses a package but can also be a stored procedure. No problems.
What is your problem?

Oracle sql types over dblink

I have two schemas: A and B (Oracle 9). At the A there is a dblink to B. At the B there is a package, that i calls from A. Procedures in B package can returns varying count results and i think that returning a collection is a better way for this reason.
create type B.tr_rad as object (
name varchar2(64)
,code number
,vendor number
,val varchar2(255)
,num number
);
create type B.tt_rad as varray(256) of B.tr_rad;
But from A scheme I cannot use tt_rad type because using SQL-types by dblink is not supported. DBMS_SQL is not supported cursors. Create types with same OID is impossible.
I think to use temporary tables. But firstly it is not that good (after the remote function returns the value, calling side must select collection from remote table). And there are fears of a slowdown of work with temporary tables.
Maybe who knows the alternative interaction?
I've had similar problems in the past. Then I came to the conclusion that fundamentally Oracle's db links are "broken" for anything but simple SQL types (especially UDT's, CLOBS may have problems, XMLType may as well). If you can get the OID solution working then good luck to you.
The solution I resorted to was to use a Java Stored procedure, instead of the DB Link.
Characteristics of the Java Stored Procedure:
Can return a "rich set of types", just about all of the complex types (UDT's, tables/arrays/varrays) see Oracle online documentation for details. Oracle does a much better job of marshalling complex (or rich) types from java, than from a DBLink.
Stored Java can acquire the "default connection" (runs in the same session as the SQL connection to the db - no authentication issues).
Stored Java calls the PL/SQL proc on the remote DB, and the java JDBC layer does the marshaling from the remote DB.
Stored Java packages up the result and returns the results to the SQL or PL/SQL layer.
It's a bit of work, but if you have a bit of java, you should be able to "cut and paste" a solution together from the Oracle documentation and sample.
I hope this helps.
See this existing discussion
referencing oracle user defined types over dblink
An alternative interaction is to have one database with schemas A and B instead of two databases with a database link.
My solution.
On the side B i create temporary table like the collection record. At the A side i have a DBMS_SQL wrapper that calls procedure over dblink. This procedure writes result collection in the temporary table. After successful completion remote procedure i select results from remote temporary table and transform it to local collection type.
Limitations
1. the need for permanent object synchronization.
2. impossibility use A-side procedure (that call remote procedure) in SQL query.
3. the complexity of using.

Resources