The stored procedure PL/SQL - t - it accept the custom Ref Cursor type?

I am not able to compile the following procedure in the HR schema comes with default oracle... I use Oracle 11g Release 11.2.0.2.0 Express edition. It gives me an error (given after the code block):

Block of code:
CREATE OR REPLACE PROCEDURE TEST_REF IS
DECLARE
TYPE REF_EMP IS REF CURSOR RETURN % ROWTYPE EMPLOYEES;
RF_EMP REF_EMP;
V_EMP EMPLOYEES % ROWTYPE;
BEGIN
DBMS_OUTPUT. ENABLE (1000000);
OPEN FOR RF_EMP
SELECT * FROM EMPLOYEES WHERE EMPLOYEE_ID > 100;
EXTRACT THE RF_EMP IN V_EMP;
DBMS_OUTPUT. PUT_LINE (V_EMP. FIRST_NAME. ' ' || V_EMP. LAST_NAME);
CLOSE RF_EMP;
EXCEPTION
WHILE OTHERS
THEN DBMS_OUTPUT. PUT_LINE (SQLERRM);
END TEST_REF;
/

Error:
Errors in PROCEDURE TEST_REF:

LINE/COL ERROR
-------- -----------------------------------------------------------------
2/1 PLS-00103: encountered the symbol "DECLARE" when waiting for an a
What follows:
Start function < an ID > pragma procedure subtype type
< between double quote delimited identifiers > delete the current cursor
There are the external language prior
The symbol 'start' is substituted for 'DECLARE' continue.

16/13 PLS-00103: encountered the symbol "end-of-file" when waiting for him
one of the following values:
(begin case declare exit end exception for goto if loop mod)
pragma raise return null select update while with

Get rid of the DECLARED:

SQL> CREATE OR REPLACE PROCEDURE TEST_REF IS
  2  TYPE REF_EMP IS REF CURSOR RETURN HR.EMPLOYEES%ROWTYPE;
  3  RF_EMP REF_EMP;
  4  V_EMP EMPLOYEES%ROWTYPE;
  5  BEGIN
  6  DBMS_OUTPUT.ENABLE(1000000);
  7  OPEN RF_EMP FOR
  8  SELECT * FROM EMPLOYEES WHERE EMPLOYEE_ID > 100;
  9  FETCH RF_EMP INTO V_EMP;
 10  DBMS_OUTPUT.PUT_LINE(V_EMP.FIRST_NAME || ' ' || V_EMP.LAST_NAME);
 11  CLOSE RF_EMP;
 12  EXCEPTION
 13  WHEN OTHERS
 14  THEN DBMS_OUTPUT.PUT_LINE(SQLERRM);
 15  END TEST_REF;
 16  /

Procedure created.

SQL> set serveroutput on
SQL> exec TEST_REF;
Donald OConnell

PL/SQL procedure successfully completed.

SQL> 

SY.

Tags: Database

Similar Questions

  • execution of stored procedure in sql developer/sql more with a table setting?

    Hello

    I create a package with a procedure which has a cursor ref as output and a type as an input parameter.  Here is my definition of the package

    PACKAGE 
    -------
    CREATE OR REPLACE PACKAGE TEST
    As
      TYPE RefCursorType IS REF CURSOR;
      type intTableType is table of varchar2(50) index by binary_integer;
      
      PROCEDURE GETDATA (
              P_RECORDS OUT RefCursorType,           
               YEAR_LIST IN intTableType
      );  
    END;
    
    
    PACKAGE BODY
    -----------------------
    
    SET DEFINE OFF
    CREATE OR REPLACE PACKAGE BODY TEST
    AS 
    PROCEDURE GETDATA
    (
      P_RECORDS OUT RefCursorType,  
      YEAR_LIST IN intTableType  
    )
    AS 
    iYearList  IDTableType;
    BEGIN 
      --GET ARRAY COUNT
      IYEARLIST := IDTABLETYPE();
      IYEARLIST.EXTEND(YEAR_LIST.COUNT);
      
      --LOOP THROUGH LISTS AND POPULATE ARRAY
      FOR I IN YEAR_LIST.FIRST .. YEAR_LIST.LAST
      LOOP
      IYEARLIST(I) := IDTYPE(TO_CHAR(YEAR_LIST(I)));
      END LOOP;
      
       OPEN P_RECORDS FOR 
       SELECT CITHTML AS FORMATTED
        FROM dbTest.FORMATTED_HTML
      WHERE YEAR IN (SELECT * FROM TABLE(IYEARLIST))
      ;
      END GETDATA ;
    END TEST ;
    /
    
    

    I want to perform this procedure from the sql or sql developer more to see if it works properly.   The year field dbTest.FORMATTED_HTML is defined as varchar2 (20 bytes).  He has many years as well as text.

    I've used this in the past with simple stored procedures, but not those with a table setting

    var r refcursor;

    exec GETOLDDATA(:r,40);

    print r;

    How can I modify this to allow him to run my stored procedure?

    Thank you

    Just declare SQL, not type of PL/SQL:

    CREATE OR REPLACE

    TYPE Str50TblType

    AS THE TABLE OF THE VARCHAR2 (50)

    /

    CREATE OR REPLACE

    THE TEST PACKAGE

    IS

    GETDATA PROCEDURE)

    P_RECORDS ON SYS_REFCURSOR,

    YEAR_LIST IN Str50TblType

    );

    END;

    /

    CREATE OR REPLACE

    TEST OF PACKAGE BODY

    IS

    GETDATA PROCEDURE)

    P_RECORDS ON SYS_REFCURSOR,

    YEAR_LIST IN Str50TblType

    )

    IS

    BEGIN

    OPEN P_RECORDS

    FOR

    SELECT CITHTML AS FORMATTED

    OF dbTest.FORMATTED_HTML

    WHERE YEAR IN)

    SELECT *.

    TABLE (YEAR_LIST)

    );

    GETDATA END;

    END TEST;

    /

    SY.

  • PLS-00201 error occurs when the batch a stored procedure in SQL * more

    I have a batch file to run a stored procedure and the coil results in file. When I enter orders manually in sql * plus the output works very well and my results are spooling in the output file. But when I run the same commands in the script I get an error batch.


    Any ideas?

    Stored procedure:

    create or replace procedure MMP (p_cursor in the SYS_REFCURSOR)

    as

    Start

    Open p_cursorfor select name, id from table;

    end;

    batch file 1:

    sqlplus-s user/pw@REPORTDV @sp_output_spooled.sql

    sp_output_spooled.SQL script file

    Paste these commands directly on the SQL * more guest wraps the result as expected the value leader.

    the colsep value ' |'

    trigger the echo

    Set feedback off

    termout off Set

    set the position

    set linesize 9000

    set pagesize 0

    Set trimspool on

    headsep off Set

    output of the coil. TXT

    var refcursor rc

    run MMP(:rc)

    print the rc

    spool off

    output

    Errors printed to the output. TXT file after the batch is executed and error occurs:

    BEGIN MMP(:rc); END;

    *
    ERROR on line 1:
    ORA-06550: line 1, column 8:
    PLS-00201: identifier 'MMP' must be declared.
    ORA-06550: line 1, column 8:
    PL/SQL: Statement ignored


    ERROR:
    ORA-24338: statement handle not executed


    SP2-0625: variable printing error "rc".

    Hello

    Your code worked fine for me.

    Procedure MMP is owned by the same user that runs the batch file or does it means and appropriate privileges?

    VR,

    Sudhakar

  • How to test the stored procedure in SQL Developer or SQL Plus

    Hello

    It's small, but I am confused. Can someone give me the EXACT command to run to test my stored procedure described below. Please don't refer me to the documentation or offer some sort of pseudocode. I've been through the documentation - and through it again - and I just don't get it. I know that the procedure works in general because I'm calling ColdFusion, but I want to test developer SQL or SQL more before I call my ColdFusion page - it only makes sense. I'm probably not initialize variables right or something - not sure.

    You will see that it is a line right insert in the firstname and lastname data base and there are 2 IN OUT values as well. Please use a fake name for the firstname and lastname values to demonstrate. I appreciate it!

    create or replace
    procedure sp_insertDirector_A)
    vFirstname IN Directors.Firstname%TYPE,
    vLastname IN Directors.Lastname%TYPE,
    vInsertStatus in on NUMBER,
    vNewDirectorID IN OUT NUMBER
    )
    IS
    row_count NUMBER;
    BEGIN
    SELECT Count (*) FROM directors WHERE Lastname vLastname = row_count;
    IF row_count > 0 THEN
    vInsertStatus: = - 1;
    RETURN;
    END IF;

    INSERT INTO administration)
    FirstName, Lastname)
    VALUES)
    vFirstname, vLastname
    );

    SELECT Directors_Seq.CURRVAL INTO vNewDirectorID FROM DUAL;
    vInsertStatus: = 1;
    END;

    If someone can tell me exactly how to test, I'd appreciate it. I asked on another site and got many responses that I tried and did not work due to various errors. Once I get a working example, I'm sure I can get the idea and continue on. I mainly use the SQL Developer.

    Thank you, mallethead

    p.s. I think that my if - THEN followed by the instruction INSERT is fixed - it is woring. Seems a little odd to me however.
    declare
       l_instatus  number;
       l_newdirid  number;
    begin
       sp_insertDirector_A('bob','smith',l_instatus,l_newdirid);
       dbms_output.put_line(l_instatus);
       dbms_output.put_line(l_newdirid);
    end;
    /
    
  • How to call a stored procedure PL/SQL of the Disqualification?

    I figured I could do this from a Groovy script but I am unable to make it work.

    Let's take the simplest scenario:

    At the end of a job, I have a need to call an once stored procedure that has no arguments.

    Translated by the logic of the stored procedure with Disqualification is not an option.

    If you must call it once at the end of a task, you must use the external task.

    If you call a procedure for each record, it can be done using a script.

  • by using the stored procedure in sql statement?

    I have the following sample tables:

    project id project name
    ====== ===============
    1 project one
    2 two project
    3 three of the project


    employee_id fname lname
    =========== =============     =====
    Amy 100a
    Better B 200
    Carrie 300 C


    project number
    ===========     ===========
    1,200 people
    2 300
    of 3 100

    There's a getFullname (empployee_id) of the procedure in place that combines the fname lname full name

    what I need to accomplish is the following.

    project is created by employee
    ==============================
    project a is created by better b
    two project is created by carrie C
    three project is created by amy A

    but the rule is: you need to call the getFullName (employee_id) procedure to perform the above task and do not use join tables to get the employee full name

    I suspect that you want something along the lines of

    SELECT 'Project ' || p.project_name || ' was created by ' || get_full_name( pe.employee_id )
      FROM project p,
           project_employee pe
     WHERE p.project_id = pe.project_id
    

    If you need other attributes in the employee table, you can join at the table of the employees as well.

    Justin

  • Interactive reporting stored procedure Oracle SQL to return

    I have the type of region of next report:

    Type of report of area:
    SQL query (body of function from PL/SQL returning SQL query)

    Source of the region:

    DECLARE
    q varchar2 (4000);
    BEGIN
    GetMySQLString (: P22715_SID, q);
    Return to q;
    END;


    function GetMySQLString() return varchar2 is
    Start
    return ' select * from myTable ";

    end GetMySQLString;





    For some reason though I can't figure out how to work with an interactive report... Basically I want the report to use the SQL returned by the Oracle stored function...

    Any thoughts?

    Should have sought better!

    Guess this should help: procedure call or an interactive report function

    Published by: tward on 3 Sep, 2010 08:55

  • LabVIEW FPGA. Where should I put the custom controls - or type defs in a project

    Hello

    Maybe this is a stupid question - but I'm a little confused on where within a project I should put the controls (or type defs) used in FPGA screws.  If you put in the bit "module FPGA" project, so they come up as "dependencies" - as if they are not in the project within the project when you read/write values in the target FPGA.  Also, it seems that if you copy the project to a different location folder then the FPGA vi can be distributed in a way that she needs to be recompiled - even if you don't change anything - that's not cool if it takes an hour or two to compile.

    I had the controls in the external project for awhile - but seems not ideal from the point of view modular programming, and also, it seems that it may also cause the recompilation unnessary - although perhaps less often that put them in the FPGA subproject.

    Any thoughts?

    I've seen the same behavior and it is a fact that the code must be recompiled if you move a project even if the FPGA code is unchanged. From my point of view, it's a real BUG. This is independent of any file source or target FPGA.

    The other point of your question is not clear relly. Of course, you will get the dependencies if you place the necessary files outside the structure of the target project. But I see no problem to reference them twice because it won't double the source itself. So I suggest to refer to these files several times in the project structure. Actually I'm doing this because I manage a project file LV with different targets CRIO where the complete code for the target FPGA is double referenced under each target.

    It may be useful

    Christian

  • to find the location of PL/SQL, stored PROCEDURE in the database

    Hello

    This is the detail I have the executable of the Application Developer program simultaneous

    Executable NAPESCO_STAFF_LEDGER_DTLS

    Short name NPSTALEDDTLS

    Application of human resources

    Execution of PL/SQL, stored procedure method

    Name of file execution NAPESCO_STAFF_LEDGER_DTLS


    I would like to know how to view and change this procedure, where it is stored

    kindly help

    Hello

    This seems to be a custom package. To display the source of the simultaneous program ' PL/SQL Stored Procedure', please refer to (Note: 455582.1 - where can I get the whole "stored procedure" Pl/Sql Source file on the current program?).

    Thank you
    Hussein

  • SQL stored procedure input and output parameters

    Hello Gang,

    My dead end trying to call a stored procedure in SQL Server 2008 with the LV database tool.

    for purposes of experimentation, I've created a small procedure with an input parameter that returns an integer as return value.  It works describing a query, but all attempts at LV produce an error-2147217900 when executing query VI.  I did find examples of that.

    Sending a bunch of parameters to a stored procedure and checking the value of return seems to be pretty common stuff.

    I'll appreciate any help.

    Thank you

    Roger

    Hi Roger,

    There are a few prerequisites which I will list below. If you have not checked these things, so don't hesitate, as your hiccups can be there.

    Prerequisites:

    1. Ensure that you can read from a table in the database to verify that you can access the database (user permissions) and ensure that your login details are correct. Among other things, make sure that the. DSN switches to the correct database. (See the simple example below, SQL Select.vi)
    2. Make sure that your user (if you use SQL authentication) has permissions to run the STORED procedure by running the procedure in SQL Server Management Studio (you seem to have already done this)

    Example by calling a procedure without parameters (attached as SPROC_No_Parameters.vi):

    Example by calling a procedure with parameters (attached as SPROC_Parameters.vi):

    An article on the execution of stored procedures is here:

    http://digital.NI.com/public.nsf/allkb/07FD130746083E0686257300006326C4

    Don't forget to download the example VI since it includes the cases where you want an output parameter of the procedure rather than a table.

    I tested these against two very simple SPROCs and it worked fine (on SQL Server 2005, but 2008 should be the same).  Stored procedures have been:

    CREATE PROCEDURE [dbo]. [GetContacts]

    AS
    BEGIN
    -SET NOCOUNT ON added to avoid additional results sets from
    -interfering with SELECT statements.
    SET NOCOUNT ON;

    -Controls insert for procedure here
    SELECT * FROM Contacts
    END

    and

    CREATE PROCEDURE [dbo]. [MultiplyAges]
    @param1 INT = 1
    AS
    BEGIN
    -SET NOCOUNT ON added to avoid additional results sets from
    -interfering with SELECT statements.
    SET NOCOUNT ON;

    -Controls insert for procedure here
    SELECT (age * @param1) OF Contacts
    END

    I would like to know if these examples work for you or if you have any other questions.  Don't forget to go through this KB article and articles related to it, they should cover other situations.

    Matt

  • Materialized view, based on the stored procedure

    Hi all

    is it possible to create a materialized view on the results returned by a stored procedure?

    If this is not the case, do you think that any other way except for filling a table with data from the stored procedure and then founded the MV on it?

    Thanks in advance.

    MichaelTsilikidis wrote:

    Sorry I don't speak properly. In fact the procedure does not return a value, it fills one of its parameters (of the ref cursor type) of data. That's what I wanted.

    No it's not.

    REF CURSOR don't store data, so it's not possible.

    A Ref cursor is just a pointer to a query... and you can't "select from" a ref cursor, you can retrieve only one open.

    PL/SQL 101: Understand the Ref Cursor

    As correctly stated above, you can't question from a procedure to a function, and a materialized view is based on a query, you cannot use a procedure in a materialized view.

    You could use a function pipeline instead of a procedure, or have the pipeline function obtain the results of the procedure and pipelines, and then the materialized view could be based on the results of this function in the pipeline.

    example of function pipeline:

    SQL > CREATE or REPLACE TYPE AS OBJECT num_descript (num number, descript varchar2 (30))
    2.

    Type of creation.

    SQL >
    SQL > CREATE or REPLACE TYPE tbl_num_descript AS TABLE OF THE num_descript
    2.

    Type of creation.

    SQL >
    SQL >
    SQL > CREATE or REPLACE PACKAGE AS-reftest
    2 FUNCTION pipedata (number p_choice) tbl_num_descript RETURN PIPELINED;
    3 END;
    4.

    Package created.

    SQL >
    SQL > CREATE or REPLACE PACKAGE BODY AS-reftest
    2 FUNCTION pipedata (number p_choice) tbl_num_descript RETURN PIPELINED IS
    3 v_obj num_descript: = num_descript (NULL, NULL);
    4 v_rc sys_refcursor;
    5 BEGIN
    6. IF p_choice = 1 THEN
    7 v_rc OPEN to SELECT empno as num, ename like descript FROM emp;
    8 ELSIF p_choice = 2 THEN
    9 OPEN v_rc to SELECT deptno as num, dname as descript OF THE Department;
    10 END IF;
    11 LOOP
    12 FETCH v_rc INTO v_obj.num, v_obj.descript;
    EXIT 13 WHEN v_rc % NOTFOUND;
    14 PIPE ROW (v_obj);
    15 END LOOP;
    16 v_rc NARROW;
    RETURN 17;
    18 END;
    END 19;
    20.

    Package body created.

    SQL > select * from table (reftest.pipedata (1));

    DESCRIPT NUM
    ---------- ------------------------------
    7369 SMITH
    7499 ALLEN
    7521 WARD
    7566 JONES
    7654 MARTIN
    7698 BLAKE
    7782 CLARK
    7788 SCOTT
    KING 7839
    7844 TURNER
    7876 ADAMS
    JAMES 7900
    7902 FORD
    7934 MILLER

    14 selected lines.

    SQL > select * from table (reftest.pipedata (2));

    DESCRIPT NUM
    ---------- ------------------------------
    10 ACCOUNTING
    SEARCH 20
    30 SALES
    40 OPERATIONS

  • How to convert MS SQL Server 2008 Stored Procedures of Oracle 11 g SPs?

    We have an application from MS SQL Server 2008. We want to migrate to Oracle 11 g.

    What is the recommended Oracle method for
    (1) migration of data (Tables, triggers, sequences, views etc..)
    (2) the stored Procedure migration.

    What is the recommended tool or method pls?

    We have 100s of MS Sql Server stored procedures. Then, needing a tool or method. We can rewrite all of them from scratch.

    Hello

    Let me clarify some of the issues that you mention. But I advise you to get some professional help with migration because:

    1. you must understand the architectural differences between SQL Server and Oracle. They are of different databases.
    2. understand data type mappings.
    3. understand the complete migration process. Just using the OTN article as a migration guide won't help because it just shows how use SQL Developer to this task.
    4. understand that 100% of successful Oracle conversion is not possible with all the tools. There will always be gaps, gaps in functionality, bugs etc. So there will be some amount of manual work involved.
    5. There are many other tasks involved in the migration that cannot be accomplished with SQL Developer.

    Get now your questions:

    1. in 3.1, there is migration option for the "capture of database in offline mode". It is under the Tools option. So in 3.1 we do not have a separate tab, called "Migration."
    2. use 3.1 because it is much better than 2.1 in terms of capabilities.
    3 migration Wizard is the easiest way to migrate. Where are you getting confused?
    4 "column data" seems to be a stored procedure in SQL Server. If it is not there in the underlying table, why he uses in the SQL statement in the procedure then? I think that we have a problem of "reserved word" with the name of column "Data". Will have to check that.
    5 VARCHAR (@max) must be mapped to VARCHAR2 (4000) in Oracle. It may be a bug in SQL Developer. So during the mapping of data type in the migration wizard, you can change the default mappings.

    Concerning

    Prakash

  • Dashboard of the guests and stored procedures

    Hello

    I have 7 guests - 2 which are necessary and others are optional. I created guests from Dashboard and grouped 2 those required in a dashboard command prompt and more optional 5 in an another guest of dashboard. All the guests are assigned to the variables and used in calling a stored procedure in SQL Server. Because I have 2 groups there are 2 go buttons on the page. I found that the order in which I enter data and click on the questions of buttons and will disrupt the call to the proc (i.e. sometimes it brings back data but sometimes she will be not based on recorded fast values).

    I have 2 questions:
    1. is it possible to separate the optional and mandatory guests so I can put them in separate the dashboard sections, but to have only 1 'Go' button to send the data?

    2. among the guests, I would like to be a multiple selection. Is it possible to send the options of multiple selections in a stored procedure? I use the variables to other values, but I've read using a variable for multiple selection is not possible.

    Any help would be appreciated
    Thank you
    UNA

    Issues related to the:
    1. not in the standard, but with a bit of javascript, it is possible
    http://sranka.WordPress.com/2008/11/09/how-to-replace-multi-go-button-prompt-by-one/
    2. it is not possible in 10 g but possible normally as promised to 11 g. You must create camps prompt or a command prompt with the different possibilities to pass a string instead of an array or a list.

    Success
    Nico

  • java.sql.SQLException: ORA-06550 and ORA-00900 call stored procedures

    Hi all

    I have 2 a stored procedures that I want to call from my Session bean. One of them takes a few settings, but not the other. When I call the procedures, I get the following errors described below. I tested the two stored procedures in sql plus and sqldveleoper and they work well. The funniest, it is, I have another stored procedure that I can call successfully from the same bean in session with no problems, so I'm a bit confused as to why his play now.

    I use stand-alone 10.1.3.4 OC4J and Oracle 10 g Db 10.2.0.4 and platform DB that I use is Oracle10gPlatform and Eclipselink as my JPA provider. I have also tried against toplink (not toplink essentials) and still no joy

    Here is the error I get when I try and call the procedure which takes the parameters of the session bean
    Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'HASHDATA'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    
    Error Code: 6550
    Call: BEGIN HashData(input=>?, hashedValue=>?, hashed=>?); END;
         bind => [password1, => hashedValue, => hashed]
    Query: DataReadQuery()
    Here are my stored procedure that take parameters
    create or replace procedure hashData(input IN VARCHAR2, hashedValue OUT BLOB, hashed OUT BOOLEAN)  as  
    
    inputRaw RAW(2000);
    --hashed BOOLEAN := false;
    begin 
    
    dbms_output.put_line('the data to be hashed is '||input);
    
    dbms_output.put_line('converting input to raw ...');
    inputRaw := utl_i18n.string_to_raw(input,'AL32UTF8');
    
    dbms_output.put_line('Hashing Data ...');
    hashedValue := DBMS_CRYPTO.Hash (src=>inputRaw,typ=>DBMS_CRYPTO.HASH_SH1);
    
    dbms_output.put_line('hash is '||UTL_I18N.raw_to_char(dbms_lob.substr(hashedValue, 4000,1)));
    
    if (hashedValue  is not null) then 
     
    
     hashed :=true;
      dbms_output.put_line('hashedValue IS NOT  null');
     else
     hashed := false;
      dbms_output.put_line('hashedValue IS null');
     end if;
    
    end;
    Here is my code in the session bean to call the procedure that takes as parameters (Hashdata)

    public UserBean() {
              // TODO Auto-generated constructor stub
    
              sessMan = SessionManager.getManager();
              session = sessMan.getSession("Session", Thread.currentThread()
                        .getContextClassLoader());
    
         }
    
    public Serializable hashData(String input){
    
              logger.debug("Hashing Data ... "); 
              hashedValue= null; 
              boolean hashed=false; 
         
              StoredProcedureCall call = new StoredProcedureCall();
    
              ValueReadQuery query = new ValueReadQuery();
              call.setProcedureName("HashData");
              call.addNamedArgumentValue("input", input);
              call.addNamedOutputArgument("hashedValue", "hashedValue", java.sql.Blob.class);
              call.addNamedOutputArgument("hashed", "hashed", java.lang.Integer.class);
                        
              query.addArgument("input");
              
              query.setCall(call);
              
              session.executeQuery(query);
               
              if ((Boolean)hashed){
                   logger.debug("The data has been hashed and the hash value is: "+hashedValue);
              }
              
              else{
                   logger.debug("The data has could not be hashed");
                   hashedValue=null;
              }
              
              return (Serializable)hashedValue;
              }
    When I call the other takes no parameters, I get the following error.
    Internal Exception: java.sql.SQLException: ORA-00900: invalid SQL statement
    
    Error Code: 900
    Call: BEGIN testJPAProc(); END;
    Query: DataReadQuery()
    Here is the procedure which takes no parameters
    create or replace procedure testJPAProc is 
     
     begin
     dbms_output.put_line('testJPAProc called');
     end;
    Heres is the code to call procedures that take no parameters
                                    StoredProcedureCall call = new StoredProcedureCall();
      
              ValueReadQuery query = new ValueReadQuery();
              
              call.setProcedureName("testJPAProc");
              query.setCall(call);
              
              session.executeQuery(query);
    You guys can tell me where I'm wrong if I do something wrong. Why make these mistakes? because as far as I can tell the code (java and pl/sql) are both correct unless there is something I missed. It's kinda funny because I have another stored procedure I can call successfully.


    Thank you

    The first question is that the Boolean in Oracle is not a supported JDBC type, but a PLSQL type.
    Change to an INTEGER is probably the best, you can also use the PLSQLStoredProcedureCall class to access.

    The second problem is perhaps that the stored procedure is not valid, make sure that it compiled correctly. It can also be the type of your query, you must use a DataModifyQuery, not a read request that it returns nothing.
    If still no luck, try to call directly through JDBC, it works?

    ---
    James: http://www.eclipselink.org: http://en.wikibooks.org/wiki/Java_Persistence

  • Server SQL, stored procedure

    Hi all

    I use an ODI procedure to call stored procedures in SQL Server 2.

    In the steps of the procedure, I have 2 - one for each proc and the syntax is simply the name of the stored procedure.

    The overall procedure is defined as being a part of the SCENE and advanced pattern to a TEST context - the pattern of staging is SQL Server technology.

    When I run the procedure, it does not say that it cannot find the stored procedure, but if I give him a fully resolved path (i.e. db_name.dbo.usp_proc1) and restart the stage in operator, it works fine.

    Now--and correct me if I make a wrong assumption here - I thought that values for catalog and schema in the definition of database server would be added to the statement. I don't want to hard code my db_name and owner in my procedure that makes porting applications to another a little rigid environment.

    ODI obviously understands that the command is a SQL Server stored procedure but don't derive from the elements defined by the schema specified in the step of the procedure.

    Can anyone help?

    Thank you

    G

    You must use the odiRef.getObjectName () method of substitution
    This method returns the full name of a physical object, including its catalog and schema.
    Take a look at the doc for the settings...

Maybe you are looking for