Oracle Function help!!!
Hi there,
Is there any document or example for calling oracle functions and show the result sets of this functions in Oracle BI?.......
ONUR YILDIRIM wrote:
I DONT want to know how can I write oracle functions...I just WANT TO KNOW how can I show result sets in OBI????? What are the steps to do this?????I don't like your answer to be honest. It seems you are not getting that what you want to do is not directly possible in OBIEE. Few people have suggested different work arounds, don't just discard them because they don't do exactly what you want. You should adapt your data (or code) for OBIEE not the other way around. The reporting tool always has the priority in a reporting application. If you make the wrong decisions you will end up with a poor reporting application.
Similar Messages
-
Help regarding the calling of a oracle function from the OTL.
Hi,
I created a Oracle function like get_employee_id() which will return the employee id if the name and department exists.
If not exists it will insert the record and return the emp_id.
get_employee_id(name,department)
if name and department exists id will be returned
else record will be inserted and emp id will be returned.
emp_id is a sequence which will be triggered to auto increment.
Problem is::
Not getting a correct way to access get_employee_id() from OTL interface.
I am trying like
query << "BEGIN :3<int> := get_employee_id(:1<char[128]>,:2<char[1024]>); END;" ;
otl_stream oos(1, query.str().c_str(), db());
oos << emp_name ;
oos << emp_dept ;
while(true){
oos >> emp_id ;
if(!oos) break ;
Please let me know what is the correct way of accessing this.Thanks for the help in advance.Sorry, I posted this on another forum. C++ Call Interface (OCCI)
Thanks,
Jagdish. -
Help - Oracle function w/RETURN VIEW_NAME%ROWTYPE
I have a fairly complex Oracle function with a signature like this:
FUNCTION get_some_data
in_param_one VARCHAR2
, in_param_two VARCHAR2
)RETURN VIEW_NAME%ROWTYPE
(The internal logic of the function is such that it will return at most one row.)
I have sample code from MSDN that outlines calling functions in .Net, like this:
// create the command for the function
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
cmd.CommandText = "GET_EMPLOYEE_EMAIL";
cmd.CommandType = CommandType.StoredProcedure;
// add the parameters, including the return parameter to retrieve
// the return value
cmd.Parameters.Add("p_employee_id", OracleType.Number).Value = 101;
cmd.Parameters.Add("p_email", OracleType.VarChar, 25).Direction =
ParameterDirection.ReturnValue;
// execute the function
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
// output the result
Console.WriteLine("Email address is: " + cmd.Parameters["p_email"].Value);
I don't see an available OracleType to fit the '...%ROWTYPE' return value.
I think the Oracle code is doing inferred 'table inlining' but it may, instead, be using an inferred refcursor (clearly I'm no DBA). Everything I've been able to find online when googling for how to handle this in .Net doesn't seem to match this situation.
How can I call this function and get the data back in C#? Please note that I don't have the authority to modify the package to make it explicitly return a refcursor.
Thank you for any light you can shed!
MarFarMaHere's a "quick and dirty" example using the HR sample schema that I think might be enough to get you going...
Pl/SQL (used to mimic your function that returns %rowtype):
create or replace function get_country_row (p_id in varchar2) return countries%rowtype as
cursor emp_cur is select * from countries where country_id = p_id;
emp_rec emp_cur%rowtype;
begin
open emp_cur;
fetch emp_cur into emp_rec;
close emp_cur;
return emp_rec;
end;C# Code:
using System;
using System.Data;
using System.Text;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
namespace RowTypeTest
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
// create and open connection
string constr = "User Id=hr; Password=hr; Data Source=oranet; Pooling=false";
OracleConnection con = new OracleConnection(constr);
con.Open();
// build anonymous pl/sql block to get the data
StringBuilder sbSQL = new StringBuilder();
sbSQL.Append("declare ");
sbSQL.Append(" l_country_row countries%rowtype; ");
sbSQL.Append("begin ");
sbSQL.Append(" l_country_row := get_country_row(:p_id); ");
sbSQL.Append(" :p_country_id := l_country_row.country_id; ");
sbSQL.Append(" :p_country_name := l_country_row.country_name; ");
sbSQL.Append(" :p_region_id := l_country_row.region_id; ");
sbSQL.Append("end;");
// input parameter for country id
OracleParameter p_id = new OracleParameter();
p_id.OracleDbType = OracleDbType.Varchar2;
p_id.Size = 2;
p_id.Value = "UK";
p_id.Direction = ParameterDirection.Input;
// input/output parameter for country id
// this is redundant but we are selecting * from the table...
OracleParameter p_country_id = new OracleParameter();
p_country_id.OracleDbType = OracleDbType.Varchar2;
p_country_id.Size = 2;
p_country_id.Direction = ParameterDirection.InputOutput;
// input/output parameter for country name
OracleParameter p_country_name = new OracleParameter();
p_country_name.OracleDbType = OracleDbType.Varchar2;
p_country_name.Size = 40;
p_country_name.Direction = ParameterDirection.InputOutput;
// input/output parameter for region id
OracleParameter p_region_id = new OracleParameter();
p_region_id.OracleDbType = OracleDbType.Decimal;
p_region_id.Direction = ParameterDirection.InputOutput;
// create command object
OracleCommand cmd = con.CreateCommand();
cmd.CommandText = sbSQL.ToString();
// add parameters to command
cmd.Parameters.Add(p_id);
cmd.Parameters.Add(p_country_id);
cmd.Parameters.Add(p_country_name);
cmd.Parameters.Add(p_region_id);
// get the data
cmd.ExecuteNonQuery();
// display data retrieved
Console.WriteLine("{0}, {1}, {2}", p_country_id.Value, p_country_name.Value, p_region_id.Value);
// clean up objects
p_region_id.Dispose();
p_country_name.Dispose();
p_country_id.Dispose();
p_id.Dispose();
cmd.Dispose();
con.Dispose();
}Output:
UK, United Kingdom, 1This only works if the stored function returns a single row and obviously has no error handling, etc. but I hope it helps a bit...
- Mark -
Can't open oracle functions after installation R12 On windows 2008 64 bit
Hi guys
i am installed oracle R12.1.1 on windows server 2008 R2 64 bit,then the application is opening but all oracle forms functions can't open,the message appear frm-92101 ,i am try the solutions in net but no effect,and i am getting another message from windows that and this appear when try to open another oracle functions
aprogram running on this computer is trying to display a message ,then
message title:
E:\oracle\VIS\apps\tech_st\10.1.3\appsutil\jdk\bin\java "-serv
This problem accours when a program is not fully compatible with windows
This message appear when starting windows also but the java path inside oracle apps files,please help me if oracle r12.1.1 compatible with win 2008 64 bit or not???os :WINDOWS SERVER 2008-32 BIT,explorer: IE 7,
FRM-92101: There was a failure in the Forms Server during startup. This could happened due to invalid configruation. Please look into the web-server log file for details.
Details...
Java Exception:
oracle.forms.net.ConnectionException: Forms session (1) aborted: unable to communicate with runtime process
at oracle.forms.net.ConnectionException.createConnectionException(Unknown Source)
at oracle.forms.net.HTTPNStream.getResponse(Unknown Source)
at oracle.forms.net.HTTPNStream.doFlush(Unknown Source)
at oracle.forms.net.HTTPNStream.flush(Unknown Source)
at oracle.forms.net.HTTPNStream.getResponse(Unknown Source)
at java.io.DataOutputStream.flush(Unkown Source)
at oracle.forms.net.HTTPConnection.connet(Unknown Source)
at oracle.forms.engine.FormsDispatcher.initConnection(Unknown Source)
at oracle.forms.egnine.FormsDispatcher.init(Unknown Source)
at oracle.forms.egnine.Runform.initConnection(Unknown Source)
at oracle.forms.egnine.Runform.startRunform(Unknown Source)
at oracle.forms.egnine.Main.createRunform(Unknown Source)
at oracle.forms.egnine.Main.start(Unknown Source)
at sun.plugin2Applet.Panel.Plugin2Manager$.AppletExcecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source) -
How to call oracle Function which has If else condition in Data Template
Hi,
currently I am working on creating Data Template which uses a Oracle Function which I need to make use in my data template. But I have some confusions on using the same. Could anybody please help me in this regard.
I have a function like this,
function invoice_query (p_facility_id facility.facility_id%TYPE,
p_wave_nbr pick_directive.wave_nbr%TYPE,
p_container_id unit_pick_group_detail.container_id%TYPE,
p_distro_nbr unit_pick_group_detail.distro_nbr%TYPE) return invoice_refcur IS
refcur invoice_refcur;
begin
IF p_wave_nbr IS NOT NULL THEN
OPEN refcur FOR SELECT t1.distro_nbr,
t1.cust_order_nbr,
t1.pick_not_before_date,
SYSDATE,
t1.ship_address_description,
t1.ship_address1,
t1.ship_address2,
t1.ship_address3,
t1.ship_address4,
t1.ship_address5,
t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip,
t1.ship_country_code,
t1.bill_address_description,
t1.bill_address1,
t1.bill_address2,
t1.bill_address3,
t1.bill_address4,
t1.bill_address5,
t1.bill_city || ', ' || t1.bill_state || ' ' || t1.bill_zip,
t1.bill_country_code,
min(t2.pick_order),
NULL,
t2.wave_nbr
FROM stock_order t1,
pick_directive t2,
unit_pick_group_detail t3
WHERE t1.facility_id = t2.facility_id
AND t1.facility_id = t3.facility_id
AND t2.facility_id = t3.facility_id
AND t1.distro_nbr = t2.distro_nbr
AND t1.distro_nbr = t3.distro_nbr
AND t2.distro_nbr = t3.distro_nbr
AND t1.facility_id = p_facility_id
AND t2.wave_nbr = p_wave_nbr
AND g_scp(p_facility_id, 'interface_tcp_flag') = 'N'
AND t2.pick_type = 'U'
AND t3.group_id in (SELECT t4.group_id
FROM unit_pick_group t4
WHERE t4.facility_id = p_facility_id
AND t4.wave_nbr = p_wave_nbr)
GROUP BY t1.distro_nbr,
t1.cust_order_nbr,
t1.pick_not_before_date,
t1.ship_address_description,
t1.ship_address1,
t1.ship_address2,
t1.ship_address3,
t1.ship_address4,
t1.ship_address5,
t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip,
t1.ship_country_code,
t1.bill_address_description,
t1.bill_address1,
t1.bill_address2,
t1.bill_address3,
t1.bill_address4,
t1.bill_address5,
t1.bill_city || ', ' || t1.bill_state || ' ' || t1.bill_zip,
t1.bill_country_code,
t2.wave_nbr
ORDER BY MIN(t3.group_id), MAX(t3.slot);
elsif p_container_id is not null then
OPEN refcur FOR SELECT distinct t1.distro_nbr,
t1.cust_order_nbr,
t1.pick_not_before_date,
SYSDATE,
t1.ship_address_description,
t1.ship_address1,
t1.ship_address2,
t1.ship_address3,
t1.ship_address4,
t1.ship_address5,
t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip,
t1.ship_country_code,
t1.bill_address_description,
t1.bill_address1,
t1.bill_address2,
t1.bill_address3,
t1.bill_address4,
t1.bill_address5,
t1.bill_city || ', ' || t1.bill_state || ' ' || t1.bill_zip,
t1.bill_country_code,
NULL,
t2.dest_id,
null
FROM stock_order t1,
unit_pick_group_detail t2
WHERE t1.facility_id = t2.facility_id
and t1.distro_nbr = t2.distro_nbr
and t1.facility_id = p_facility_id
AND g_scp(p_facility_id, 'interface_tcp_flag') = 'N'
AND t2.container_id = p_container_id;
else
open refcur for SELECT distinct t1.distro_nbr,
t1.cust_order_nbr,
t1.pick_not_before_date,
SYSDATE,
t1.ship_address_description,
t1.ship_address1,
t1.ship_address2,
t1.ship_address3,
t1.ship_address4,
t1.ship_address5,
t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip,
t1.ship_country_code,
t1.bill_address_description,
t1.bill_address1,
t1.bill_address2,
t1.bill_address3,
t1.bill_address4,
t1.bill_address5,
t1.bill_city || ', ' || t1.bill_state || ' ' || t1.bill_zip,
t1.bill_country_code,
NULL,
NULL,
t3.wave_nbr
FROM stock_order t1,
unit_pick_group_detail t2,
unit_pick_group t3
WHERE t1.facility_id = t2.facility_id
and t2.facility_id = t3.facility_id
and t1.distro_nbr = t2.distro_nbr
and t2.group_id = t3.group_id
and t1.facility_id = p_facility_id
AND g_scp(p_facility_id, 'interface_tcp_flag') = 'N'
AND t2.distro_nbr = p_distro_nbr;
END IF;
return refcur;
end;
I have created data template like following,
<sqlStatement name="Q_INVOICE">
<![CDATA[
SELECT Pack_Slip_R.invoice_query(:P_FACILITY_ID,:P_WAVE_NBR,:P_CONTAINER_ID,:P_DISTRO_NBR) from dual
]]>
</sqlStatement>
But how does I create a element for the "t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip" column in the oracle function. I normally create an element like following,
<group name="G_INVOICE" source="Q_INVOICE">
<element name="CUST_ORDER_NBR" value="cust_order_nbr"/>
<element name=":dest_id" value="dest_id"/>
</Group>
But how do i create element if a column name is kind of dynamic. Please help. I cannot Rename/change the Column in SQL Query. Please let me know If I could handle this whole logic in BI Publsiher.
Regards,
Ashoka BLtry useing alias
t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip as <COLUMN_ALIAS> -
Using nested select in oracle functions
hi, im new to oracle functions, and im trying to write a function using a nested select statment, but i get the error
Error: PLS-00428: an INTO clause is expected in this SELECT statement
can anyone help point out what i am doing wrong, The sql select statment works on a worksheet, so i guess its the way i am using the function
create or replace function Media_Object_Name(Detail_id Number) return varchar2 as
Result varchar2(300);
begin
select promo_name from promo where promo_id =
(select promo_id from promo_plan where promo_plan_id =
(select promo_plan_id from event_promotion where detail_id = Detail_id)) into ;
return(Result);
end Media_Object_Name;
thanks
jamesThe into clause should go here:
SELECT promo_name
INTO Result
FROM promo
WHERE promo_id = (SELECT promo_id
FROM promo_plan
WHERE promo_plan_id = (SELECT promo_plan_id
FROM event_promotion
WHERE detail_id = detail_id));I don't know about your data modell, but are you sure you need nested selects?
C. -
Oracle functions with PowerPivot
Hi All,
I have a requirement of building reports using Oracle functions in PowerPivot.
I have tried using Table Import Wizard and Command Type=StoredProcedure in th ePowerPivot.
Any help will be appreciated.
Thanks and Regards,
SSHello,
I don't think we can use Oracle functions/stored procedures in PowerPivot, please see the similar thread below:
http://social.technet.microsoft.com/Forums/en-US/22e67f7f-0753-4f21-bae2-1812d2daf03e/powerpivot-oracle-stored-procedure-err-the-sql-statement-is-not-valid-there-are-no-columns?forum=sqlkjpowerpivotforexcel
I would suggest you elaborate your requirement with more detail.
Regards,
Elvis Long
TechNet Community Support -
Error Accessing an Oracle Function
Hi There,
I am trying to access an oracle function and getting an
error.
CREATE OR REPLACE FUNCTION simple RETURN VARCHAR2 IS
BEGIN
RETURN 'Simple Function';
END simple;
<cfstoredproc procedure="simple" datasource="MySource"
returnCode ="no">
<CFPROCRESULT name="simple_function">
</cfstoredproc>
Error:
Error Executing Database Query. [Macromedia][SequeLink JDBC
Driver][ODBC Socket][Oracle][ODBC]Syntax error or access violation.
I do have access to this function. I tried it from SQL Plus
and it works fine.
any help in this will be highly appreciated.
Regards,As per Adam Cameron advice, I changed my SQL function:
CREATE OR REPLACE FUNCTION simple RETURN VARCHAR2 IS
a varchar2(10) := '';
BEGIN
select 'Simple' into a from dual;
Return a;
END simple;
As per paross1 advice, I changed my code to:
<cfstoredproc procedure="simple" datasource="MySource"
returnCode ="yes">
<CFPROCRESULT name="simple_function">
</cfstoredproc>
I am still getting the following error:
Error Executing Database Query. [Macromedia][SequeLink JDBC
Driver][ODBC Socket][Oracle][ODBC]Syntax error or access violation.
The error occurred on line 53.
Any advice will be highly appreciated. -
Call Oracle Function from ASP++++!
I have a lot of Oracle function in packages and i would like use it in my ASP pages.
With Oracle procedure it's all right.
Sample like this
set cn = Server.CreateObject("ADODB.Connection")
connString = "Provider=MSDAORA.1;Data Source=<>;User ID=<>;Password=<>"
cn.Open connString
SQL = "{call test.test_asp({resultset 0, cResult})}"
Set cmd = Server.CreateObject ("ADODB.Command")
Set cmd.ActiveConnection = cn
cmd.CommandText = SQL
cmd.CommandType = 1 'adCmdText
Set rs = Server.CreateObject ("ADODB.RecordSet")
Set rs = cmd.Execute
If NOT (rs.BOF and rs.EOF) Then
Do while NOT rs.EOF
<%=rs("dfcountry")%>
<%=rs("dfname")%>
rs.MoveNext
LOOP
End if
And in package TEST i have
PROCEDURE TEST_ASP(cResult IN OUT ResultCursor)
IS
BEGIN
OPEN cResult FOR
SELECT *
FROM tcountry;
END TEST_ASP;"
I Hope You help me with similar call a function!!!
For example, this is one
FUNCTION test_fun
RETURN resultcursor
IS
vres resultcursor;
BEGIN
OPEN vres FOR
SELECT *
FROM tcountry;
RETURN vres;
END test_fun;Stored Procedures
When executing an Oracle PL/SQL stored procedure using a command, use Oracle native syntax or the ODBC procedure call escape sequence in the command text:
Oracle native syntax: BEGIN credit_account(123, 40); END;
ODBC syntax: {CALL credit_account(123, 40)}
Preparing Commands
OraOLEDB validates and fetches the metadata only for SELECT SQL statements.
Command Parameters
When using Oracle ANSI SQL, parameters in the command text are preceded by a colon. In ODBC SQL, parameters are indicated by a question mark ("?").
OraOLEDB supports input, output, and input/output parameters for PL/SQL stored procedures and stored functions. OraOLEDB supports input parameters for SQL statements.
Joel P�rez -
Calling oracle function from Access passthrough query does not return list
Thanks to the help I received in an earlier post I've created an oracle 10g function that returns a list after executing the sql it contains. It works in oracle, using sql developer.
I need to have the list that it returns show up in MS Access via a passthrough query. It's not working so far. The connection string etc is ok, I'm able to use passthrough queries to run sql strings successfully. But when I try to call the function via the Access passthrough query at first nothing seems to happen (ie no list appears) and if I try to run it again, there is a odbc error 'call in progress. Current operation canceled'. There are only the three records in the table. I'm missing something, can anyone spot it?
The passthrough query looks like this
select * from fn_testvalues from dual
Again that runs in oracle.
To create the testing table and 2 functions see below.
CREATE TABLE t_values (MyValue varchar2(10));
Table created
INSERT INTO t_values (
SELECT 'Merced' c1 FROM dual UNION ALL
SELECT 'Pixie' FROM dual UNION ALL
SELECT '452' FROM dual);
3 rows inserted
CREATE OR REPLACE FUNCTION fn_isnum(p_val VARCHAR2) RETURN NUMBER IS
n_val NUMBER;
BEGIN
n_val := to_number(p_val);
RETURN 1;
EXCEPTION
WHEN OTHERS THEN
RETURN 0;
END;
Function created
testing the table:
SELECT val, fn_isnum(MyValue ) isnum
FROM t_values;
VAL ISNUM
Merced 0
Pixie 0
452 1
Now the function that is called in the passthrough query:
create or replace function fn_testvalues
return sys_refcursor is
rc sys_refcursor;
begin
open rc for
Select t_values.*, fn_isnum(MyValue) IsNum from t_values;
return(rc);
end fn_testvalues;lecaro wrote:
OK. But obviously there is some oracle object that one can call via an Access pass-through query which returns rows?Just to clarify. You could fetch data in Access from an Oracle function that returns a ref cursor using VBA editor. To use a pass-through query Oracle function should be a table function or pipelined table function:
CREATE OR REPLACE
TYPE testvalues_obj_type
AS OBJECT(
val varchar2(10),
isnum number
CREATE OR REPLACE
TYPE testvalues_tbl_type
AS TABLE OF testvalues_obj_type
CREATE OR REPLACE
FUNCTION fn_testvalues
RETURN testvalues_tbl_type
PIPELINED
IS
CURSOR testvalues_cur
IS
SELECT testvalues_obj_type(MyValue,fn_isnum(MyValue)) testvalues_obj
FROM t_values;
BEGIN
FOR v_rec IN testvalues_cur LOOP
PIPE ROW(v_rec.testvalues_obj);
END LOOP;
RETURN;
END;
/To test it in Oracle:
SELECT *
FROM TABLE(fn_testvalues)
VAL ISNUM
Merced 0
Pixie 0
452 1
SQL> Now in Access pass-trough query window enter:
SELECT *
FROM TABLE(fn_testvalues);SY. -
JAVA Calling Oracle Function and Returning OBJECT
HI,
I am working as a developer in java/j2ee project.
I am facing one issue:
I need to call Oracle function from java code. Oracle User define function is residing in oracle package and returning Object which contains data.
Can you please help me
With Best Regardsgolduniya wrote:
I need to call Oracle function from java code. Oracle User define function is residing in oracle package and returning Object which contains data.
Can you please help meIt requires a great deal of Oracle jdbc driver specific code.
[http://download-west.oracle.com/docs/cd/B10501_01/java.920/a96654/oraint.htm#1012664] -
Problem calling Oracle function from Access 2007 / ADO
Hopefully, I'm posting this in the correct forum. I'm also posting on an Access forum as I'm not entirely sure where the issue lies.
I'm calling an Oracle function from Access 2007 using an ADO Command object.
The function takes three input parameters and has a return value and an output parameter. The output parameter is a BLOB, and the return value is varchar2 (either "T" or "N") based on the outcome of the function.
If I pass correct values to the function, I get the following error message (errs out on the command.execute line):
Run-time error '-2147467259 (80004005)':
[Oracle][ODBC][Ora]ORA-06502: PL/SQL: numeric or value error
ORA-06512: at line 1
Here's the function:
FUNCTION GET_ITEMREV_ATTACH(P_ORGANIZATION_ID IN NUMBER,
P_INVENTORY_ITEM_ID IN NUMBER,
P_REVISION IN VARCHAR2,
X_DRAWING OUT BLOB) RETURN VARCHAR2 IS
RESULT VARCHAR2(1);
BEGIN
RESULT := 'T';
BEGIN
SELECT L.FILE_DATA
INTO X_DRAWING
FROM FND_ATTACHED_DOCUMENTS AD,
MTL_ITEM_REVISIONS_B IR,
FND_DOCUMENTS_TL D,
FND_LOBS L
WHERE AD.ENTITY_NAME = 'MTL_ITEM_REVISIONS' AND
AD.PK1_VALUE = IR.ORGANIZATION_ID AND
AD.PK2_VALUE = IR.INVENTORY_ITEM_ID AND
AD.PK3_VALUE = IR.REVISION_ID AND
AD.CATEGORY_ID = 1001216 AND
D.DOCUMENT_ID = AD.DOCUMENT_ID AND
D.LANGUAGE = 'US' AND
L.FILE_ID = D.MEDIA_ID AND
IR.ORGANIZATION_ID = P_ORGANIZATION_ID AND
IR.INVENTORY_ITEM_ID = P_INVENTORY_ITEM_ID AND
IR.REVISION = P_REVISION;
EXCEPTION
WHEN OTHERS THEN
RESULT := 'N';
END;
RETURN(RESULT);
END GET_ITEMREV_ATTACH;
Here's the VB code I'm using to call the function:
Private Sub Command8_Click()
Dim CMD As New ADODB.Command
Dim conn As ADODB.Connection
Dim Param1 As ADODB.Parameter
Dim Param2 As ADODB.Parameter
Dim Param3 As ADODB.Parameter
Dim ParamBlob As ADODB.Parameter
Dim ParamReturn As ADODB.Parameter
Set conn = New ADODB.Connection
With conn
.ConnectionString = "Driver={Oracle in OraHome92};Dbq=OAPLY;UID=***;PWD=*******"
.CursorLocation = adUseClient
.Open
End With
Set CMD = New ADODB.Command
Set CMD.ActiveConnection = conn
CMD.CommandText = "immi_attach_pub.get_itemrev_attach"
CMD.CommandType = adCmdStoredProc
Set ParamReturn = CMD.CreateParameter("RESULT", adVarChar, adParamReturnValue, 1)
CMD.Parameters.Append ParamReturn
Set Param1 = CMD.CreateParameter("P_ORGANIZATION_ID", adInteger, adParamInput, 1, 6)
CMD.Parameters.Append Param1
Set Param2 = CMD.CreateParameter("P_INVENTORY_ITEM_ID", adInteger, adParamInput, 4, 5207)
CMD.Parameters.Append Param2
Set Param3 = CMD.CreateParameter("P_REVISION", adVarChar, adParamInput, 2, "04")
CMD.Parameters.Append Param3
Set ParamBlob = CMD.CreateParameter("X_DRAWING", adLongVarBinary, adParamOutput, 200000)
CMD.Parameters.Append ParamBlob
CMD.Execute , , adExecuteNoRecords *** this is where the error occurs
conn.Close
MsgBox CMD.Parameters("RESULT")
End Sub
I've tried using different data types for the varchar2 parameters (adVarChar, adBSTR, adChar) with no difference.
If I pass a bogus value for Param3...."'04'"...the function returns "N" indicating that it actually executed something. But, when I pass the correct value "04", it returns the above mentioned error.
I can execute the function in PL/SQL just fine, so I'm thinking there's something wrong with the parameters, datatype, or other definitions on the Access side.
Does anyone have any thoughts? I'm at a dead end with this. Sorry for the long post. Thank you.I tried your code with 11107 ODBC/client/database (but with a NULL output blob for convenience sake) and got no errors.
If you're using 92 ODBC/client, you may want to try upgrading to something more current, or at least getting the latest patch(9208) to see if that helps. Since it works for me I'm guessing it may be a resolved bug in that version.
Hope it helps,
Greg -
Return type Boolean From Oracle Function
1. How do I get a return type of Boolean from Oracle function in Java?
2. I have a function fx overloaded in Oracle (8 variances) and I have trouble getting the right one in Java. Is 8 too high a figure or Java does not support calling overloaded functions or what?
Thanks for any help.I am facing a similar situation, where I have defined an overloaded function in one package (2 variants) which both return a type BOOLAN value.
I am having trouble to setting up an CallableStatemnt to call one of this functions from Java. Whenever I set the parameter with a BIT or NUMBER data type, I get an exception with java.lang.boolean during my
callablestatement.setobject( indez, parameter, OracleTypes.BIT );
or
callablestatement.setobject( indez, parameter, OracleTypes.NUMBER );
I have no problem calling the function from SQLPlus, but doing so from Java raises the exception. I have found no exact match in OracleTypes or java.sql.Types for a BOOLEAN data type.
In your response do you mean to modify the Function to return a NUMBER instead of a BOOLEAN, or do you mean to set the parameter as Types.NUMBER in the calling java code?
Thanks,
Fedro -
Pl-Sql Oracle Function Concurrency Issue
Hi All,
Issue - pl-sql Oracle Function performance issue, when muliple users are accessing the function
Detail -
Oracle 11g / Linux Server
I have developed a pl-sql oracle function to retrieve information from 3 tables, output as a particluar type array.
Single request is getting processed within 2.2 seconds, but when multiple request are sent concurrently <tested with 50>, time taken for each output is different.
BreakUp of Response times:-
8 messages took - 2.2 sec
+8 messages took - 4.4 sec
++8 messages took - 6.6 sec....etc
I'm looking for any DB tunning parameter, which will help to resolve this issue.
My only aim is to expose developed function to multiple users, who all can access it concurrently, but response should limit within 2.2 seconds.
Any thoughts + guidance is higly appreciated.
Thanks
Preetam SinghSupporting data insert statements:
=======================================================================================================================
REM INSERTING into EXPERTISE
Insert into EXPERTISE (USH_USER_NAME,USH_SKILL_SET1,USH_SKILL_SET2,USH_SKILL_SET3,USH_SKILL_SET4,USH_SKILL_SET5,USH_SKILL_SET6,USH_SKILL_SET7,USH_SKILL_SET8,USH_SKILL_SET9,USH_SKILL_SET10,USH_SKILL_SET11,USH_SKILL_SET12,USH_SKILL_SET13,USH_SKILL_SET14,USH_SKILL_SET15,USH_SKILL_SET16,USH_SKILL_SET17,USH_SKILL_SET18,USH_SKILL_SET19,USH_SKILL_SET20) values ('A','ENGLISH','FRENCH','HINDI',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);
Insert into EXPERTISE (USH_USER_NAME,USH_SKILL_SET1,USH_SKILL_SET2,USH_SKILL_SET3,USH_SKILL_SET4,USH_SKILL_SET5,USH_SKILL_SET6,USH_SKILL_SET7,USH_SKILL_SET8,USH_SKILL_SET9,USH_SKILL_SET10,USH_SKILL_SET11,USH_SKILL_SET12,USH_SKILL_SET13,USH_SKILL_SET14,USH_SKILL_SET15,USH_SKILL_SET16,USH_SKILL_SET17,USH_SKILL_SET18,USH_SKILL_SET19,USH_SKILL_SET20) values ('B',null,'GERMAN','CHINIESE','HINDI',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);
Insert into EXPERTISE (USH_USER_NAME,USH_SKILL_SET1,USH_SKILL_SET2,USH_SKILL_SET3,USH_SKILL_SET4,USH_SKILL_SET5,USH_SKILL_SET6,USH_SKILL_SET7,USH_SKILL_SET8,USH_SKILL_SET9,USH_SKILL_SET10,USH_SKILL_SET11,USH_SKILL_SET12,USH_SKILL_SET13,USH_SKILL_SET14,USH_SKILL_SET15,USH_SKILL_SET16,USH_SKILL_SET17,USH_SKILL_SET18,USH_SKILL_SET19,USH_SKILL_SET20) values ('C','ENGLISH',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);
=======================================================================================================================
==================================================================
REM INSERTING into WORKING
Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('A','MON','09:00','18:00');
Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('A','TUE','09:00','18:00');
Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('A','WED',null,null);
Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('A','THU','09:00','18:00');
Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('A','FRI','09:00','12:00');
Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('B','MON','09:00','18:00');
Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('B','TUE','09:00','18:00');
Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('B','WED','09:00','18:00');
Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('B','THU','09:00','18:00');
Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('B','FRI','09:00','18:00');
Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('C','MON',null,null);
Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('C','TUE','09:00','18:00');
Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('C','WED','09:00','18:00');
Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('C','THU','09:00','18:00');
Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('C','FRI','09:00','12:00');
==================================================================
=====================================================================================================================
REM INSERTING into SCHEDULE
Insert into SCHEDULE (APPOINTMENTDATE,APPOINTMENTSTART,APPOINTMENTEND,STATUS,NAME) values (to_timestamp('11-FEB-12 10.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 10.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 11.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),'MEETING','A');
Insert into SCHEDULE (APPOINTMENTDATE,APPOINTMENTSTART,APPOINTMENTEND,STATUS,NAME) values (to_timestamp('11-FEB-12 10.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 10.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 11.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),'TRAINING','B');
Insert into SCHEDULE (APPOINTMENTDATE,APPOINTMENTSTART,APPOINTMENTEND,STATUS,NAME) values (to_timestamp('13-FEB-12 10.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 10.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 11.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),'MEETING','A');
Insert into SCHEDULE (APPOINTMENTDATE,APPOINTMENTSTART,APPOINTMENTEND,STATUS,NAME) values (to_timestamp('11-FEB-12 10.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 11.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 11.30.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),'MEETING','B');
=====================================================================================================================
Edited by: 910614 on Feb 10, 2012 9:29 AM -
Call Oracle Function via JDBC Adapter
Hi to everybody,
using JDBC connection with an Oracle DB, from XI I manage to send messages to execute SQL statements or Stored Procedures. Does anybody know if there is a way to call also an Oracle Function?
Thanks a lot for any help...
IlariaHi Illaria,
I think i agree with Michal. The solution to your problem would be to go for a stored procedure. The link on SDN help only tells us that a stored procedure can be executed and does not discuss about oracle functions.
http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
So, Stored Procedures, it has to be.
Regards,
Bhavesh
Maybe you are looking for
-
how do I set up a new external hard drive with my recovered iTunes (from a hard drive that crashed & had to be replaced) so that I can access iTunes on my iMac again?
-
HT3787 I'm running 10.8.2, can I still find the previous local copy?
I can't find the item when searching my lbrary, would it be labelled differently?
-
How do I get an updateable ResultSet ?
Using Oracle 8.1.7 JDBC libs. My code reads thus: Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = stmt.executeQuery("select * from my_table"); rs.moveToInsertRow(); .. yet I see this
-
We have droids, iPhone 4s and 5. We moved into a huge community with about 8 subdivisions and houses are 10 years old. I cannot make a call in my home and have to stand in the road to talk to anyone. Zip code 29860 - not rural! I chatted with Ver
-
Can I reinstall photoshop without having to pay for it again?
I currently have photoshop elements 10 on my computer, but I need to restore my computer. If I still have the instillation disk can I reinstall photoshop without having to buy it again?