Problems binding array in C# to stored procedure.

I'm having trouble trying to pass an array of ID's to a stored procedure that is expecting an array (listed the procedure definition below). My current interface doesn't return an error, but it also doesn't insert the proper id's.
STORED PROCEDURE DEFINITION:
TYPE source_ids IS TABLE OF wweb.DM_ASSOCIATIONS.source_id%TYPE INDEX BY PLS_INTEGER;
PROCEDURE add_message_associations
(p_dm_message_id IN wweb.dm_messages.dm_message_id%TYPE
,p_association_type IN wweb.dm_associations.association_type%TYPE
,p_sources IN source_ids
,p_create_user IN wweb.dm_associations.create_user%TYPE)
.......variable definitions here...
v_source_id := p_sources.First;
WHILE v_source_id IS NOT NULL
LOOP
-- Check if this association already exists.
-- If not add them.
v_assoc_exists := 0;
FOR r_chk IN
(SELECT 1 AS assoc_exists_flag
FROM dm_associations a
WHERE a.dm_message_id = p_dm_message_id
AND a.association_type = p_association_type
AND a.source_id = v_source_id)
LOOP
v_assoc_exists := r_chk.assoc_exists_flag;
END LOOP;
IF v_assoc_exists = 0 THEN
-- Add the association
INSERT INTO wweb.dm_associations
(dm_association_id
,dm_message_id
,association_type
,source_id
,source_column_name
,active_flag
,create_date
,create_user
,last_update_date
,last_update_user)
VALUES
(wweb.dm_associations_s.NEXTVAL
,p_dm_message_id
,p_association_type
,v_source_id
,v_source_column_name
,1
,SYSDATE
,p_create_user
,SYSDATE
,p_create_user);
END IF;
.......error handling here...
C# CODE:
OracleParameter[] param = new OracleParameter[4];
param[0] = new OracleParameter("p_dm_message_id", OracleDbType.Long);
param[1] = new OracleParameter("p_association_type", OracleDbType.Varchar2, 5);
param[2] = new OracleParameter("p_sources", OracleDbType.Int32);
param[3] = new OracleParameter("p_create_user", OracleDbType.Varchar2, 25);
param[0].Value = 1;
param[1].Value = "ER";
param[2].Value = new Int32 [] {1, 172, 412, 7953};
param[3].Value = "SVC-GDESAI";
param[2].CollectionType = OracleCollectionType.PLSQLAssociativeArray;
param[2].Size = 4;
param[2].ArrayBindStatus = new OracleParameterStatus[4]{OracleParameterStatus.Success, OracleParameterStatus.Success, OracleParameterStatus.Success, OracleParameterStatus.Success};
cn = new OracleConnection(ConnectionString);
cn.Open();
OracleCommand cmd = new OracleCommand();
cmd.Connection = cn;
cmd.CommandText= "dynamic_messages_api.add_message_associations";
cmd.CommandType= CommandType.StoredProcedure;
foreach (OracleParameter p in param)
if ((p.Direction == ParameterDirection.InputOutput || p.Direction == ParameterDirection.Input) && (p.Value == null || p.Value.ToString() == ""))
p.Value = DBNull.Value;
cmd.Parameters.Add(p);
cmd.ExecuteNonQuery();
This ran fine, and created four rows in the table, but the source id's were (1, 2, 3, 4) instead of (1, 172, 412, 7953) which were the ones I passed in.
Does anyone know what I'm doing wrong here?
Thanks,
Gauranga

Hi,
I think you have a problem in you PL/SQL procedure. When you receive an array in the procedure, it is your responsibility to parse it explicitely with a loop or to bulk insert with a "forall" (implicit).
For instance, here is an example of a procedure of mine. I don't catch exceptions as I want the C# calling code to know about them:
The type t_* are defined like yours.
procedure UpdateDistribDates(p_bannerid in t_bannerid,
p_promonumber in t_promonumber,
p_datenumber in t_datenumber,
p_actualdate in t_actualdate ) is
BEGIN
-- First delete the existing dates in bulk
FORALL I IN P_BANNERID.FIRST..P_BANNERID.LAST
DELETE FROM PROMODISTRIBDATE
WHERE BANNERID = P_BANNERID(I)
AND PROMONUMBER = P_PROMONUMBER(I);
-- Then, insert the values passed in arrays.
FORALL I IN P_BANNERID.FIRST..P_BANNERID.LAST
INSERT INTO PROMODISTRIBDATE
(BANNERID,
PROMONUMBER,
DATENUMBER,
ACTUALDATE)
VALUES (P_BANNERID(I),
P_PROMONUMBER(I),
P_DATENUMBER(I),
P_ACTUALDATE(I));
END;
As you can see, the FORALL keyword will process the arrays passed as any other PL/SQL array in one chunk.
When you do the insert like:
INSERT INTO wweb.dm_associations
(dm_association_id
,dm_message_id
,association_type
,source_id
,source_column_name
,active_flag
,create_date
,create_user
,last_update_date
,last_update_user)
VALUES
(wweb.dm_associations_s.NEXTVAL
,p_dm_message_id
,p_association_type
,v_source_id
,v_source_column_name
,1
,SYSDATE
,p_create_user
,SYSDATE
,p_create_user);
In source_id, you insert the index of the table, not the value of the field.
I would suggest you completely rewrite this procedure by using the explicit loop like this:
1/ Explicit loop
FOR i IN 1 .. p_sources.COUNT LOOP
-- Check the existence
EXIST_FLAG := 0;
BEGIN
SELECT 1
INTO EXIST_FLAG
FROM ...
WHERE ...
AND a.source_id = p_source(i) <-- You are parsing here
AND ...
EXCEPTION
WHEN OTHERS THEN -- Nothing was found
EXIST_FLAG := 0;
END;
IF (EXIST_FLAG = 1)
INSERT INTO wweb.dm_associations
(dm_association_id
,dm_message_id
,association_type
,source_id
,source_column_name
,active_flag
,create_date
,create_user
,last_update_date
,last_update_user)
VALUES
(wweb.dm_associations_s.NEXTVAL
,p_dm_message_id
,p_association_type
,p_source(i) <-- You parse here
END IF;
END LOOP;
2/ Implicit loop and bulk insert
You would need to completely review the logic and build an array that maps exactly the row of the table you are trying to insert into. Parse the array and check for the existence of your entry, delete the row in memory when not found, then, after the loop do a bulk insert with a "forall".
Hope it helps,
Patrice

Similar Messages

  • How to bind arrays to PL/SQL stored procedure using OCI?

    Hi,
    We are having problems trying to bind arrays to PL/SQL stored procedure using OCI. Here is the situation:
    - We have a stored procedure called "GetVEPFindTasks" with the following interface:
    PROCEDURE GetVEPFindTasks (
    p_ErrorCode OUT NUMBER,
    p_ErrorMsg OUT VARCHAR2,
    p_RowCount OUT NUMBER,
    p_VEPFindTasks OUT t_VEPFindTaskRecordTable,
    p_MaxTask IN NUMBER);
    t_VEPFindTaskRecordTable is a record with the following entries:
    TYPE t_VEPFindTaskRecord IS RECORD (
    RTCID NUMBER,
    TransNum NUMBER,
    TransTimestamp VARCHAR2(20),
    Pathname1 image_data.pathname%TYPE,
    Pathname2 image_data.pathname%TYPE,
    Pathname3 image_data.pathname%TYPE,
    OperatorID operator.id%TYPE);
    - Now, we are trying to call the stored procedure from C++ using OCI (in UNIX). The call that we use are: OCIBindByName and OCIBindArrayOfStruct to bind the parameters to the corresponding buffers. We bind all parameters in the interface by name. Now, we do bind the record's individual item by name (RTCID, TransNum, etc.), and not as a record. I don't know if this is going to work. Then, we use the bind handles of the binded record items (only record items such as RTCID, TransNum, and NOT error_code which is not part of the record) to bind the arrays (using OCIBindArrayOfStruct).
    All of the parameters that are binded as arrays are OUTPUT parameters. The rest are either INPUT or INPUT/OUTPUT parameters. Now, when we try to execute, OCI returns with an error "Invalid number or types of arguments" (or something to that sort... the number was something like ORA-06550). Please help...
    Is there any sample on how to use the OCIBindArrayOfStruct with PL/SQL stored procedures? The sample provided from Oracle is only for a straight SQL statement.
    Thank's for all your help.
    ** Dannil Chan **

    As you said:
    You have to pass in an array for every field and deconstruct/construct the record in the procedure. There is no support for record type or an array of records. Can you give me a example? I'am very urgently need it.
    thanks
    email: [email protected]

  • ORA-03111 - JCA Binding error while invoking a stored procedure in DB

    Hi,
    We are facing this problem for one interface alone.
    Need expert advice to fix this problem..
    This is scheduled to run once in a day and fails daily for past 2 weeks..
    We receive below error as response..
    Same interface worked fine for past 1 yr..
    Also it works fine if we reprocess the batch in next day morning...
    Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'DB_Legacy_To_EBS_Invoice_Conversion' failed due to: Stored procedure invocation error. Error while trying to prepare and execute the IRSOA.AR_SOA_INVOICE.TRN_GET_CUST_INV_RAW_TO_STAGE API. An error occurred while preparing and executing the IRSOA.AR_SOA_INVOICE.TRN_GET_CUST_INV_RAW_TO_STAGE API. Cause: java.sql.SQLException: ORA-03111: break received on communication channel ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution.
    AND
    Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'DB_Legacy_To_EBS_Invoice_Conversion' failed due to: Stored procedure invocation error. Error while trying to prepare and execute the IRSOA.AR_SOA_INVOICE.TRN_GET_CUST_INV_RAW_TO_STAGE API. An error occurred while preparing and executing the IRSOA.AR_SOA_INVOICE.TRN_GET_CUST_INV_RAW_TO_STAGE API. Cause: java.sql.SQLException: ORA-01013: user requested cancel of current operation ORA-06512: at "IRSOA.XXIR_AR_SOA_CUSTOMER_INVOICE", line 213 ORA-06512: at line 1 ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution
    Thanks,
    Sundaram

    Looks like the SQL might be taking a longer time to execute and might be timing out.
    Please refer the following:
    Re: ORA-01013: user requested cancel of current operation
    http://www.dba-oracle.com/t_ora_01013_user_requested_cancel_of_current_operation.htm
    Additionally, ORA-06512 indicates that there is a mismatch of the with the data length that is being processed. Refer http://www.techonthenet.com/oracle/errors/ora06512.php
    Hope this helps.
    Thanks,
    Patrick

  • Problem with JDBC results calling simple stored procedure in VC 7.0

    Hi all,
    I am building a simple VC model which calls a stored procedure on a JDBC database. I have created the system in the portal, defined the alias and user mapping, the connection test is fine and the VC "find data" lists my bespoke stored procedure.
    The stored procedure is :
    CREATE PROCEDURE dbo.dt_getBieUsers
    AS
    select * from dbo.emailuserlink
    GO
    When I test it using query analyser, it returns 3 records each with the two fields I expect - user and email address.
    I drag the model onto the workspace in VC and create an input form ( with just a submit button ). i drag the result port out to create a table. This has no fields in it.
    I build and deploy as flex and the app runs, I click the submit button and SUCCESS! I get 3 records in my table each with 2 fields. The data is all correct. The problem with this is the fields are determined at runtime it seems.
    I go back to the table and add 2 columns "email" and "address".
    i build and deploy and run the app. Again I get 3 records, but this time the contents of all of the rows is not data, but "email" and "address". The data has been replaced by the header texts in all of the rows.
    Can anyone help? Why isn't the data being put in my columns as I would expect?
    I tried to build and deploy the app as Web Dynpro rather than Flex to see if it was a bug in Flex. The application starts but when I click the submit button to run the JDBC stored procedure I get a 500 Internal Server Error
    com.sap.tc.wd4vc.intapi.info.exception.WD4VCRuntimeException: No configuration is defined for the entry JDBCFunction
        at com.sap.tc.wd4vc.xglengine.XGLEngine.createComponentInternal(XGLEngine.java:559)
        at com.sap.tc.wd4vc.xglengine.XGLEngine.getCompInstanceFromUsage(XGLEngine.java:362)
        at com.sap.tc.wd4vc.xglengine.XGLEngine.getCompInstance(XGLEngine.java:329)
        at com.sap.tc.wd4vc.xglengine.wdp.InternalXGLEngine.getCompInstance(InternalXGLEngine.java:167)
        at com.sap.tc.wd4vc.xglengine.XGLEngineInterface.getCompInstance(XGLEngineInterface.java:165)
    The JDBC connection I am using has a connection URL of jdbc:sap:sqlserver://localhost;DatabaseName=BIEUSERS
    and a driver class of com.sap.portals.jdbc.sqlserver.SQLServerDriver
    Can anyone solve my wierd problems?
    Cheers
    Richard

    Hi Richard,
    After you drag and drop the data service, right click on it and choose "Test data service". Then click on "Execute" and after you see the result on the right, click on "Add fields" button (inside the same window). Now you'll see that the fields are on the tabel. This is required only for JDBC data services, since this data (how the resultset is built) is not know in DT and it needs to be run firest - then analysed and only then you have to add the fields to the table).
    Regards,
    Natty

  • Problem passing REF CURSOR to JAVA STORED PROCEDURE

    Hi,
    I've written a small Java class with a static method and
    imported that into Oracle 8i. The method expects a
    java.sql.ResultSet object as parameter. According to the
    documentation of Oracle, a REF CURSOR (cursor variable) maps to
    java.sql.ResultSet in JDBC.
    The definition of the Java Stored Procedure was accepted without
    problems:
    CREATE OR REPLACE PROCEDURE RESULTSETPASSINGTESTPROC (row
    WASTypes.GenericCurType)
    as language java
    name 'sqlj.ResultSetPassingTest.testResultSetPassing
    (java.sql.ResultSet)';
    WASTypes is a package containing the definition of the generic
    cursor:
    CREATE OR REPLACE PACKAGE WASTYPES
    is
    TYPE GenericCurType IS REF CURSOR;
    END WASTypes;
    In a function I'm opening the cursor via
    'Open cursorVariable for sqlStatement';
    Then this cursor variable is passed to the java method and the
    error ORA-03113 is shown.
    I tried to solve the problem by changing the type of the
    parameter to oracle.sql.REF without success.
    Does anybody know what wents wrong?
    Thanks in advance.
    Jan

    Hi,
    I've written a small Java class with a static method and
    imported that into Oracle 8i. The method expects a
    java.sql.ResultSet object as parameter. According to the
    documentation of Oracle, a REF CURSOR (cursor variable) maps to
    java.sql.ResultSet in JDBC.
    The definition of the Java Stored Procedure was accepted without
    problems:
    CREATE OR REPLACE PROCEDURE RESULTSETPASSINGTESTPROC (row
    WASTypes.GenericCurType)
    as language java
    name 'sqlj.ResultSetPassingTest.testResultSetPassing
    (java.sql.ResultSet)';
    WASTypes is a package containing the definition of the generic
    cursor:
    CREATE OR REPLACE PACKAGE WASTYPES
    is
    TYPE GenericCurType IS REF CURSOR;
    END WASTypes;
    In a function I'm opening the cursor via
    'Open cursorVariable for sqlStatement';
    Then this cursor variable is passed to the java method and the
    error ORA-03113 is shown.
    I tried to solve the problem by changing the type of the
    parameter to oracle.sql.REF without success.
    Does anybody know what wents wrong?
    Thanks in advance.
    Jan

  • How to send an array of values to stored procedures in java

    can anyone tell me how ican send a two dimensional array of string values can be send to a data base at one go.
    actually i am a java developer and the technolgies i am using are servlets and java data base connectivity(JDBC). the oracle developer with whom i have worked has created aprocedure for taking the two values. she has created a record and she has used the the record as an in parameter to the procedure. that particular record has two columns and i need to send it as a two dimensional array.

    The PL/SQL webservice functionality in Oracle WebServices can expose PL/SQL procedures as webservices.
    If you are just looking for Java solution, check out JPublisher, which maps PL/SQL stored procedure into JDBC programs.

  • Problem in OUT Parameter in the stored procedure

    Hi,
    I have a problem in the OUT parameter of the stored procedure under the package. I encountered the error PLS-00306. Below are the codes.
    Package
    CREATE OR REPLACE package body test as
         procedure sp_countries(rst OUT country_typ) as
         sql_stmt VARCHAR2(300);
         begin
         sql_stmt := 'SELECT * FROM countries WHERE region_id = 1';
         OPEN rst FOR sql_stmt;     
         end;
    end test;
    by the way. i declared the country_typ as this:
    TYPE country_typ IS REF CURSOR;
    Here is the code that will call this package:
    declare
    tst countries%ROWTYPE;
    begin
    test.sp_countries(tst);
    dbms_output.put_line(tst.country_name);
    end;

    Works for me. Although I had to use emp instead of your table:
    SQL> create or replace
      2  package test as
      3     TYPE country_typ IS REF CURSOR;
      4     procedure sp_countries(rst OUT country_typ);
      5  end;
      6  /
    Package created.
    SQL> CREATE OR REPLACE
      2  package body test as
      3     procedure sp_countries(rst OUT country_typ) as
      4        sql_stmt VARCHAR2(300);
      5     begin
      6        sql_stmt := 'SELECT * FROM emp WHERE deptno = 20';
      7        OPEN rst FOR sql_stmt;
      8     end;
      9  end test;
    10  /
    Package body created.
    SQL> var tcur refcursor
    SQL> exec test.sp_countries(:tcur);
    PL/SQL procedure successfully completed.
    SQL> print tcur
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-80        800                    20
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
    SQL>

  • Problem while running the report from stored procedure

    Hi,
    I using stored procedure to generate my report.
    my stored procedure's code looks like this.
    CREATE OR REPLACE PROCEDURE PROJECTOVERVIEWREPORT1(query in VARCHAR2)
    IS
    myPlist SRW_PARAMLIST;
    myIdent SRW.Job_Ident;
    myStatus SRW.Status_Record;
    BEGIN
    srw.start_Debugging;
    myPlist := SRW_PARAMLIST(SRW_PARAMETER('',''));
    srw.add_parameter(myPlist,'GATEWAY','http://localhost:8888/reports/rwservlet');
    srw.add_parameter(myPlist,'SERVER','rep_kalyan1');
    srw.add_parameter(myPlist,'REPORT','BillFormat.RDF');
    srw.add_parameter(myPlist,'USERID','atl3_dev_jul04/atl3_dev_jul04@mgi');
    srw.add_parameter(myPlist,'destype','file');
    srw.add_parameter(myPlist,'desformat','pdf');
    srw.add_parameter(myPlist,'documentnumber','17181');
    srw.add_parameter(myPlist,'papertype','N');
    srw.add_parameter(myPlist,'desname','c:\temp\17181.pdf');
    myIdent := srw.run_report(myPlist);
    myStatus := srw.report_status(myIdent);
    srw.stop_Debugging;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHEN OTHERS THEN
    NULL;
    END PROJECTOVERVIEWREPORT1;
    Iam running the oc4j instance and the report server in my local machine.
    when i have typed http://localhost:8888/reports/rwservlet
    Iam able to see the help page.
    My rdf file is placed in OralceHome/reports/integ folder.
    Iam executing my stored procedure it is returning some error.
    Iam doing any thing wrong.
    Do i need to modify anything.
    Is the place of rdf file correct.
    plz help me solving the above problem.
    --Kalyan                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    This is the error message iam getting..
    any idea????
    * WELCOME TO EVENT-BASED-REPORTING API *
    * API-Version : 9i *
    * (C) Oracle Corporation, 2000 *
    * Debugging turned ON *************************************
    *** Length of Paramlist : 1
    OK : Parameter added : GATEWAY=http://localhost:8888/reports/rwservlet
    *** Length of Paramlist : 2
    OK : Parameter added : SERVER=rep_kalyan1
    *** Length of Paramlist : 3
    OK : Parameter added : REPORT=BillFormat.RDF
    *** Length of Paramlist : 4
    OK : Parameter added : USERID=atl3_dev_jul04/atl3_dev_jul04@mgi
    *** Length of Paramlist : 5
    OK : Parameter added : DESTYPE=file
    *** Length of Paramlist : 6
    OK : Parameter added : DESFORMAT=pdf
    *** Length of Paramlist : 7
    OK : Parameter added : DOCUMENTNUMBER=17181
    *** Length of Paramlist : 8
    OK : Parameter added : PAPERTYPE=N
    *** Length of Paramlist : 9
    OK : Parameter added : DESNAME=c:\temp\17181.pdf
    Starting run_report: building url
    *** Building URL (RUN_REPORT)
    OK : URL built : http://localhost:8888/reports/rwservlet?SERVER=rep%5Fkalyan1&REPORT=BillFormat%2ERDF&USERID=atl3%5Fdev%5Fjul04%2Fatl3%5Fdev%5Fjul04%40mgi&DESTYPE=file&DESFORMAT=pdf&DOCUMENTNUMBER=17181&PAPERTYPE=N&DESNAME=c%3A%5Ctemp%5C17181%2Epdf&statu
    *** Submitting HTTP Request
    *** using URL :http://localhost:8888/reports/rwservlet?SERVER=rep%5Fkalyan1&REPORT=BillFormat%2ERDF&USERID=atl3%5Fdev%5Fjul04%2Fatl3%5Fdev%5Fjul04%40mgi&DESTYPE=file&DESFORMAT=pdf&DOCUMENTNUMBER=17181&PAPERTYPE=N&DESNAME=c%3A%5Ctemp%5C17181%2Epdf&statusf
    ERROR : HTTP request failed

  • Binding multi-byte string to stored procedure parameters

    Can someone post a piece of sample code to show how to bind a multi-byte string to a stored procedure's INPUT parameter?
    Thank you!
    Regards, Nancy

    Can someone post a piece of sample code to show how to bind a multi-byte string to a stored procedure's INPUT parameter?
    Thank you!
    Regards, Nancy

  • Problem with comparion of clobs in stored procedure

    Hi ,
    i have a stored procedure which involves a clob variable and a string comparison.
    Below is my procedure
    CREATE OR REPLACE PROCEDURE TEMP_SP (
    empId IN VARCHAR2)
    IS
    tempStr CLOB :='Hello';
    finalStr CLOB :='world';
    BEGIN
    IF finalStr = 'xxx' THEN
    tempStr := ' ';
    finalStr := finalStr || empId;
    END IF;
    IF trim(finalSqltoCur) IS NOT NULL AND tempStr <> ' ' THEN
    finalStr := finalStr || ' and ' || tempStr;
    ELSE
    finalStr := finalStr || tempStr;
    END IF;
    dbms_output.put_line('=========final string value======' || finalStr);
    END TEMP_SP;
    I would like to know why it goes to the else block as tempStr <> ' ' will be true
    and trim(finalSqltoCur) IS NOT NULL also results as true.
    It would be great if some one could help me with this.
    Regards
    Shyam

    > trim(finalStr) IS NOT NULL AND tempStr <> ' '
    And this is (TRUE AND TRUE) and evaluates to TRUE - which means the ELSE block will not be executed,
    SQL> declare
    2 empId number := 123;
    3 tempStr CLOB :='Hello';
    4 finalStr CLOB :='world';
    5 begin
    6 IF finalStr = 'xxx' THEN
    7 tempStr := ' ';
    8 finalStr := finalStr || empId;
    9 END IF;
    10
    11
    12 IF trim(finalStr) IS NOT NULL AND tempStr <> ' ' THEN
    13 finalStr := finalStr || ' and ' || tempStr;
    14 ELSE
    15 finalStr := finalStr || tempStr;
    16 END IF;
    17
    18 DBMS_OUTPUT.put_line('=========final string value======' || finalStr);
    19 end;
    20 /
    =========final string value======world and Hello
    PL/SQL procedure successfully completed.
    SQL>
    Tested on Oracle 10.2.0.1.

  • Problem with execute SSIS package from stored procedure

    Hi,
    I would like to execute SSIS package from stored procedure. Therefore, I implemented sp which exec SSISDB.CATALOG.CREATE_EXECUTION method. When I try to test it from SSMS on remote server, I got error that
    I was able to solve by adding “WITH EXECUTE AS …”. Then I got another error: The server principal "Domain\user" is not able to access the database "SSISDB" under the current security context. On Internet, I found a couple post that describe
    how to access SSIS catalog (one of them by Ke Yang -
    http://blogs.msdn.com/b/mattm/archive/2012/03/20/ssis-catalog-access-control-tips.aspx). It didn’t help. I’m still getting the error message.
    How to debug this issue?
    Any suggestion?
    Thanks
    SQL Server 2014 BI

    SSMS does not propagate user credentials thus the error
    Arthur
    MyBlog
    Twitter

  • Problem while creating table dynamically using stored procedure

    Hi all
    When i try to execute the following lines get insufficient privilege error.
    FYI: i m able to create table statically.(i.e without using stored procedure)
    CREATE OR REPLACE PROCEDURE pcalling IS
    str varchar2(60);
    BEGIN
    str:='create table t15(tno number,tname varchar2(5))';
    execute immediate str;
    END;
    Thanks in advance
    Satya

    hi
    SQL> CREATE OR REPLACE PROCEDURE runddl (ddl_in in VARCHAR2)
      2     AUTHID CURRENT_USER
      3  IS
      4  BEGIN
      5     EXECUTE IMMEDIATE ddl_in;
      6  END;
      7  .
    SQL> /
    Procedure created.AUTHID CURRENT_USER clause before the IS keyword which runddl executes, it should run under the authority of the invoker, or current user not the authority of the definer.
    if you omit it then it will no longer will be run if the creator doesnt have privelege to run this ddl regardless invoker has or not.
    i hope you got it
    Khurram Siddiqui
    [email protected]

  • Problemas when trying to execute a stored procedure

    hi.
    I'm trying to execute a stored procedure but i'm receiving this error:
    WSIF JCA Execute of operation 'myoperation' failed due to: Could not create/access the TopLink Session.
    This session is used to connect to the datastore. [Caused by: Connection Cache with this Cache Name is Disabled]
    ; nested exception is:
    ORABPEL-11622
    Could not create/access the TopLink Session.
    This session is used to connect to the datastore. [Caused by: Connection Cache with this Cache Name is Disabled]
    See root exception for the specific exception. You may need to configure the connection settings in the deployment descriptor (i.e. $J2EE_HOME/application-deployments/default/DbAdapter/oc4j-ra.xml) and restart the server. Caused by Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.4.0) (Build 080602)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: Connection Cache with this Cache Name is DisabledError Code: 17142.
    My bpel was working before and now i can't figure out what is going wrong.
    Thank you.

    'exec' is an sqlplus directive. If you run this query in PHP, try:
    $query = "BEGIN
    load_image('distribuido.JPG', '1');
    END;";
    (you may have to remove the ; after 'END')

  • Passing an array of objects to stored procedure(oracle)

    I have to pass an array of objects to a pl/sql stored proc.
    Its prototype is,
    proc_orderins(ordernum varchar2(14), ct newTask)
    where newTask is an array of objects:
    type task as object ( name varchar2(20),odd varchar2(8),sdd varchar2(8));
    create or replace type newTask as VARRAY(25) OF Task;
    will the following work from the java code :
    public class CriticalTask
    String name,odd,sdd;
    public CrticalTask(String name,String odd,String sdd)
    this.name=name;
    this.odd=odd;
    this.sdd=sdd;
    Object [] ctasks =new Object[7];
    for(i=0;i<7;i++)
    Object=new CrtitcalTask("x","x","x");
    String query="{call proc_orderins(?,?)}";
    CallableStatement cstmt=con.prepareCall(query);
    cstmt.setInt(123);
    cstmt.setObject(ctasks);
    cstmt.execute();
    will the above code work, when I am passing an array?

    Use code tags when you post code.
    I am rather certain that the code you posted will not work.
    Technically you should be able to use the java.sql.Array interface.
    The newest Oracle drivers might support that (you would have to investigate how to use it.)
    It is however possible that it isn't supported. If not then you will have to use one of the Oracle specific classes that is documented in the Oracle jdbc documentation.

  • Problem in framing a query in stored procedure

    I have problem in framing a query string.
    This query contains a link (ie hyperlink). In this i have to add single quotes and double quotes in the middle. I dont know how to frame this query. I am sending this query. I am getting an error message "missing double quotes in the expression". So kindly frame this query.
    Thanks in advance.
    Here is my query
    sql_Query := 'SELECT DISTINCT(topic_name) TOPIC,course_title TITLE,'||'''''||course_description||'||
    '''''"Description",'||'''COURSE''"ModuleName"'||
    ' FROM V_COURSE '||' WHERE COURSE_ID IN('||'''NOTHING'''||')';

    Don't try to write a query like this in one time. Do it step by step (adding the next string every time), print the result with dbms_output.put_line, and see at which point the error occurs.

Maybe you are looking for

  • HT204409 After ios 6 update on ipad 2 no wifi ability including airport

    Purchased a second iPad 2 for my wife to take along on our vacationa and just before leaving home the pop-up to update to ios 6 came up on her machine. She selected it and immediately we lost wifi connection and have notbeen able to establish it sinc

  • Video files in Dreamweaver?

    Hi there, What video file would you recommend to upload so that at least 90 per cent of people can view my vides when they hit play? Also, is it pretty easy to add videos? Steve

  • Pages refuses to open files and export

    I have become incredibly agitated as Pages will save a document then refuse to open it without any reason-does notr say it is corrupted, simply comes up with message '(doc name) cannot be opened. Also, when working on pages it has started to refuse t

  • SAP t-code F-05 to post Foreign currency valuation

    I have used SAP t-code F-05 to post Foreign currency valuation. After posting the entry H have reversed document in FB08 because of error. Unfortunately I want it to bring back to the original posting. I had reversed the reversal document in FB08. It

  • Autoextend without next

    Hello Regarding the autoextend issue, If I specify autoextend on,and omit next clause,by default the datafile will extend 1 block.(not OMF) Consider the datafile is full and segments are extended uniformly or autoallocate. When oracle attempts to ext