Variables/parrameters in stored procs

Hi All
Are there any way of specifying something other than the stored procedure name to be appended in front of local variables and parrameters in a SP when migrating from Sybase 11.9.2. Our variables mostly have the same name as table columns since sybase allows you to distinguish between them using the "@" character. In oracle though we would like to implement the proper naming standard like "v_" or something similar
Thanks

Local variables can have the local procedure name'.' or nothing appended to the front of them. There is a parser option to choose which. If this is a serious restriction please email [email protected] to raise an enhancement request.
(You could use a script to change procedurename. to v_ afterwards (?))
Turloch
Oracle Migration Workbench Team

Similar Messages

  • Value of a variable in my stored proc

    I have a cursor in my Stored Proc. which passes data to a variable "sRowcount" to store how many rows returned from the Cursor. In My Access app. I need to call the stored proc and pass the value of the last row returned.
    e.g.sRowcount=1,sRowcount=2,sRowcount=3,sRowcount=4,sRowcount=5,sRowcount=6. In my Access app, I need to call the stored proc. and get value of last row count sRowcount=6 and pass to somewhere else.
    Thanks

    YESSSS . Thanks you very much Kglad it wotk i put all in a function inside the filmstrip function Tload(theUrl){etc ect}and in the root i call it like this filmstrip.Tload(theUrl);   and it works
    code in the root var link1:Array = new Array();
    var LINK:String;
    var url:String;
    var whoOn:Number;
    whoOn=0;
    var x:XML = new XML();
    x.ignoreWhite = true;
    x.onLoad = function(success) {
    var photos:Array = this.firstChild.childNodes;
    for (i=0; i<photos.length; i++) {
    _root.link1.push(photos[i].attributes.link1);
    url=link1[whoOn];
    theUrl=url;
    filmstrip.Tload(theUrl);//<<--HERE
    x.load("category.xml");
    var cbListener:Object = new Object();
    cbListener.change = function(event_obj:Object) {
    trace(select.selectedItem.label);
    if (select.selectedItem.label == "Last updated") {
    whoOn=0;
    } else if (select.selectedItem.label == "Special") {
    whoOn=1;
    url=link1[whoOn];
    theUrl=url;
    filmstrip.Tload(theUrl);//<<-----HERE
    select.addEventListener("change",cbListener);

  • How to set variable values in Stored Procs

    Hi all,
    please excuse my newbie questions - I've spent too long using SQL Server......
    Anyway,
    I'm playing with SP basics and was wondering how I can set a variable value in a stored proc, ideally getting a value from a table or some select .
    for instance...........
    CREATE OR REPLACE PROCEDURE RPT_SP_ANT_TESTING
    P1 IN NUMBER,
    P2 IN VARCHAR2
    IS
    TmpNum NUMBER;
    TmpStr VARCHAR2(255);
    BEGIN
    --How do set these?
    SET TMPNUM := SELECT Count( * ) FROM ALL_TABLES;
    SET TMPSTR := P2 + '_APPENDED';
    INSERT INTO TEST_TABLE
    ( STRINGFIELD, NUMBERFIELD )
    VALUES
    ( TmpStr, TMPNUM )
    END;
    Regards
    DC

    Some ways are...
    setting directly
    x := 1;
    setting from a select use INTO clause
    select 1 into x from dual
    setting from a select into a collection type use BULK COLLECT INTO
    select name bulk collect into lName from your_table.
    It would be better if you read the document.
    Thanks,
    Karthick.

  • To pass new session variable value to stored proc before running a report.

    Hi,
    Below is summary of the report requirement -
    Database level design
    1. Created a view and a global temporary table (GTT)
    2. Created an Oracle package procedure to accept from and to business dates on basis of which it will fetch, process and populate the GTT.
    Repository level design
    1. Created a business model containing the view and the GTT (mentioned above)
    2. Created two SESSION variables "from_dt" and "to_dt" to be initialized by their respective init blocks. Each of the variable is initialized with a DATE column value (of type DATETIME) from a database lookup table. I have also set the option "Enable that variable to be set by any user" for both variables.
    Query for these variables :
    from_dt = select from_date from <table>
    to_dt = select add_months(from_date,12) from <table>
    Presentation level design
    1. Using a text box, i display the default/initialized values of these variables like this -
    Current business date:@{biServer.variables['NQ_SESSION.from_dt']} Future business dt:@{biServer.variables['NQ_SESSION.to_dt']}
    Dates get displayed in YYYY-MM-DD 00:00:00 format
    The text msg displays these default dates and allows the user to specift different date range for which i create prompts as shown below.
    2. Using any random two columns of date type from the business model, i create two date dashboard prompts with labels "From Dt" and "To Dt".
    i select Calender Controls for both; setting Default To = Report Defaults.
    The Set Variable is set to Presentation variables - such that pv_from_dt maps to "From Dt" and pv_to_dt maps to "To Dt".
    3. i create the report using the business model created above. In the report "Advanced Tab" => "Prefix" field i specify the following -
    SET VARIABLE from_dt='@{pv_from_dt}',to_dt='@{pv_to_dt}';
    Note : The logic here is to display the default dates and allow user to specify different date values which will be stored in presentation variables.
    If the user does specify different "from dt" and "to dt" values, then using the presentation variables, i want to "write" back these new values to the corresponding session variables mentioned above.
    If the user does not specify different date range, then the default/initialized dates must be considered.
    I also display the default and new date values in the report title.
    Back to Repository level design
    To execute the stored procedure that will load the GTT before running the report I need to pass two date parameters to the stored procedure on basis of which it will fetch data, process and populate the GTT.
    In the Connection Pool --> Connection Script Tab --> Execute before query, I wrote the below query using the repository variables FROM_DT and TO_DT to execute the procedure -
    DECLARE
    v_from_dt date;
    v_to_dt date;
    BEGIN
    v_from_dt := VALUEOF(From_Dt);
    v_to_dt := VALUEOF(To_Dt);
    package_name1.package_body(v_from_dt,v_to_dt);
    END;
    Now when i try to run the report i get the following error :
    [nQSError: 10058] A general error has occurred. [nQSError: 23006] The session variable, NQ_SESSION.to_dt, has no value definition. (HY000)..
    Need help on this.
    Is it possible to "write back" a new value to a session variable ?
    Any other alternatives.
    Thanks
    Nusrat
    Edited by: user10309945 on Jan 24, 2011 10:08 PM

    Sandeep, I found a several topics where users describe saving values in DB through stored procedure or function. For example, [How to store OBIEE presentation level variable values in DB |http://forums.oracle.com/forums/thread.jspa?threadID=892006] I tried it and get an error
    *10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 14551, message: ORA-14551: cannot perform a DML operation inside a query ORA-06512*
    It's not a BI error. This error are generated by Oracle DB. If I write next:
    SELECT MyPLSQLFunction(p1,p2) FROM DUAL
    I get the same error.
    Oracle doesn't allow DML operations in SELECT.
    Did you relalize this feature yourself? Where did I mistake?

  • Writing a Stored Proc which will execute the Queries passed to it as args

    Hi,
    I need to write a Stored Proc which gets the Query to be executed as an Argument and return the results in an OUT Variable.
    The Stored Proc i wrote is
    CREATE OR REPLACE PROCEDURE SP_FETCH_RESULTS(l_query in varchar2,
    l_returnValue out clob )
    is
    l_output utl_file.file_type;
    l_theCursor integer ;
    l_columnValue clob;
    l_status integer;
    l_results      clob;
    begin
    l_theCursor := dbms_sql.open_cursor;
    -- Parse the Query
    dbms_sql.parse( l_theCursor, ':x', dbms_sql.native );
    DBMS_SQL.BIND_VARIABLE(l_theCursor, ':x', l_query);
    -- Define the coulmnValue Variables
    dbms_sql.define_column( l_theCursor, 1, l_columnValue);
    -- Execute the Query
    l_status := dbms_sql.execute(l_theCursor);
    -- Get the Results and prepare the return Value.
    loop
    exit when ( dbms_sql.fetch_rows(l_theCursor) <= 0 );
    dbms_sql.column_value( l_theCursor, 1, l_columnValue );
         DBMS_LOB.APPEND(l_returnValue, l_columnValue);
    end loop;
    -- Close the Cursor
    dbms_sql.close_cursor(l_theCursor);
    end SP_FETCH_RESULTS;
    As the Queries paased to it always return CLOB Types i declared the OUT Variable as CLOB
    And when i try to execute is using the below given PL/SQL Block
    DECLARE
    l_Query CLOB ;
    l_retVal CLOB;
    l_results CLOB;
    BEGIN
    l_Query:='SELECT extract(object_value,''/AC'').getStringVal() into l_results from CommonAssetCatalog';
    SP_FETCH_RESULTS(l_Query,l_retVal);
    dbms_output.put_line ('Results =');
    END;
    I am getting the Error.
    ERROR at line 1:
    ORA-00900: invalid SQL statement
    ORA-06512: at "SYS.DBMS_SYS_SQL", line 906
    ORA-06512: at "SYS.DBMS_SQL", line 39
    ORA-06512: at "WEBLOGIC.SP_FETCH_RESULTS", line 13
    ORA-06512: at line 7
    Could you guys pls give me some inputs on how to resolve this..
    Thanks a lot
    Sateesh

    Hi James,
    I tried with out the Bind Variable and got the Same Error..
    The Code which i tried earlier is
    CREATE OR REPLACE PROCEDURE SP_FETCH_RESULTS(l_query in varchar2,
    l_returnValue out clob )
    is
    l_output utl_file.file_type;
    l_theCursor integer ;
    l_columnValue clob;
    l_status integer;
    l_results      clob;
    begin
    l_theCursor := dbms_sql.open_cursor;
    -- Parse the Query
    dbms_sql.parse( l_theCursor, l_query, dbms_sql.native );
    --DBMS_SQL.BIND_VARIABLE(l_theCursor, ':x', l_query);
    -- Define the coulmnValue Variables
    dbms_sql.define_column( l_theCursor, 1, l_columnValue);
    -- Execute the Query
    l_status := dbms_sql.execute(l_theCursor);
    -- Get the Results and prepare the return Value.
    loop
    exit when ( dbms_sql.fetch_rows(l_theCursor) <= 0 );
    dbms_sql.column_value( l_theCursor, 1, l_columnValue );
         DBMS_LOB.APPEND(l_returnValue, l_columnValue);
    end loop;
    -- Close the Cursor
    dbms_sql.close_cursor(l_theCursor);
    end SP_FETCH_RESULTS;
    and the Procedure got Compiled Successfully and when i ran the PL/SQL Block which calls the Above Stored Proc i got the Error
    DECLARE
    ERROR at line 1:
    ORA-00905: missing keyword
    ORA-06512: at "SYS.DBMS_SYS_SQL", line 906
    ORA-06512: at "SYS.DBMS_SQL", line 39
    ORA-06512: at "WEBLOGIC.SP_FETCH_RESULTS", line 13
    ORA-06512: at line 7
    Pls let me know how can i resolve this..
    Thanks
    Sateesh

  • Unable to pass the values to stored proc using presentation variable in OBI

    Hi All,
    Need your help regarding in resolving an issue in OBIEE 10.1.3.4.1
    There is an OBIEE requirement whereby two prompts need to be defined.
    1.     Textbox prompt
    2.     Drop-down prompt
    The dropdown values should be populated using textbox prompt. So, we have used presentation variable in textbox prompt and passing the same to select query of drop-down.
    Until this step, the report works just fine.
    Now, the value in both textbox and drop-down needs to be passed to stored proc.
    While trying to pass the values by using the presentation variable, the following error comes-up saying
    Session variable has no value definition.
    Note:Although the corresponding session variable has been set to default value,still the error appears.
    Please advise.
    Regards,
    Prasad

    "Session variable has no value definition" I'm assuming typo error and it should be presentation variable.
    Set default value for presentation variable that may work

  • Session id and Stored Proc

    How to store session id in a variable and use that in a stored proc as input param.
    I have a Stored proc in oracle which uses one input param, i want to pass session id to this proc..
    I have created a procedure from odi, and called SP from it..placed this ODI proc in a package...bt dnt knw how to pass session id as input param..

    Hi Andy,
    You can create a varaible using substitution API for this,
    select <%=odiRef.getSession("SESS_NO")%> from dual
    And in the successive call SP pass the variable like #VAR_NAME
    Thanks,
    G

  • Calling DB2 Stored Proc from Oracle DB

    Hi,
    I am having two different database running (One is oracle on solaris while the other one is db2 on os/390 mainframe) i want to pass the data realtime. Is there any way I can call a DB2 stored procedure from oracle directly. If anyboy can help in this will be really helpful.
    thanks,
    Kishor

    odi version we have is  ODI_11.1.1.6.0, it is not migrated and 'Always Execute' option is checked already.
    tried using variables in capital format but did not worked,
    begin
    schema_name.proc_name(#LV_TABLE_NAME,#LV_SCHEMA_NAME,#LV_START_DATE,#LV_END_DATE);
    end;
    odi is giving error if it finds any bug in stored proc but after fixing its completing successfully without errors in operator but i am not able to see the result.
    Please advise.

  • Calling a COBOL stored proc from Java Servlet

    I am trying to call a COBOL stored proc from a Java Servlet. The stored proc is stored on a DB2 database. I need to send 6 inputs to the COBOL stored proc and the output will be the return code of the stored proc. I'm not sure if I'm going about this the right way. This is how my code looks...
    public int callStoredProc(CallableStatement cstmt,
    Connection con,
    String sYear,
    String sReportNbr,
    String sSystemCode,
    String sUserId,
    String sModuleNbr,
    String sFormId){
    int iParm1 = 0;
    try{
    Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
    catch(ClassNotFoundException ex){
    System.out.println("Failed to locate database driver: "
    + ex.toString());
    return iParm1;
    try{
    cstmt = con.prepareCall("{? = CALL MKTPZ90C
    cstmt.registerOutParameter(1, Types.INTEGER);
    cstmt.setString(2, sYear);
    cstmt.setString(3, sReportNbr);
    cstmt.setString(4, sSystemCode);
    cstmt.setString(5, sUserId);
    cstmt.setString(6, sModuleNbr);
    cstmt.setString(7, sFormId);
    cstmt.execute();
    iParm1 = cstmt.getInt(1);
    CloseSQLStatement(cstmt);
    catch(SQLException ex) {
    CloseSQLStatement(cstmt);
    System.out.println("SQL exception occurred:" +
    ex.toString());
    return iParm1;
    return iParm1;
    Could someone tell me if this is the right way to go about doing this?
    Thanks!!!!!!

    I didn't see the code where you create the database connection (variable "con"). However, the answer to your question "Is this the right way...", for me, is "Anything that works is the right way." So try it. That's a first approximation, but once you have something that works you can start on improving it, if that becomes necessary.

  • Stored Proc with SSRS multi value parameter gives " Must Declare scalar Varaiable @StateID

    Hi All,
    I have one stored proc with @fromDate , @Todate and multivalue input
    parameter@StateID of type integer.
    When I run below stored proc via SSRS by selecting multiple values thru multiValue parameter into @StateID...it gives error saying "Must Declare scalar variable @StateID"
    Not sure what is wrong with the input parameters.
    ID is Integer type in all the 3 tables - dbo.EastCities, dbo.WestCities  , dbo.Country
    I need help fixing this  "Must Declare scalar variable @StateID" error
    This is the UDF split() I am using..
    Function:
    CREATE FUNCTION dbo.SplitStateID
    (    @List VARCHAR(MAX))
    RETURNS TABLE
    AS   
    RETURN   
    (        SELECT DISTINCT [Value] = CONVERT(INT, LTRIM(RTRIM(CONVERT( VARCHAR(12),SUBSTRING(@List, Number, CHARINDEX(',', @List + ',', Number) - Number))))
     FROM  dbo.Numbers       
     WHERE Number <= CONVERT(INT, LEN(@List))AND SUBSTRING(',' + @List, Number, 1) = ','    );
     GO
     SELECT [Value] FROM dbo.SplitStateID('10,30,50');
    Also, I have created dbo.Numbers table which is used in udf..
    reference url -- > 
    http://sqlblog.com/blogs/aaron_bertrand/archive/2009/08/01/processing-a-list-of-integers-my-approach.aspx
    SET NOCOUNT ON;
    DECLARE @UpperLimit INT;
    SET @UpperLimit = 10000;
    WITH n AS(   
    SELECT        rn = ROW_NUMBER() OVER        (ORDER BY s1.[object_id])   
    FROM sys.objects AS s1   
    CROSS JOIN sys.objects AS s2   
    CROSS JOIN sys.objects AS s3)
    SELECT [Number] = rn - 1
    INTO dbo.Numbers FROM n
    WHERE rn <= @UpperLimit + 1;
    CREATE UNIQUE CLUSTERED INDEX n ON dbo.Numbers([Number]);
    Stored procedure:
    Create Procedure dbo.CountrySelection
    ( @FromDate Date, @ToDate Date, @StateID Int)
    AS
    BEGIN
    set nocount on;
    SELECT * INTO #EastCities
    FROM (
    SELECT ID,Description from dbo.EastCities
    Where ID IN (SELECT Value from dbo.SplitStateID(@StateID))
    ) AS A
    SELECT * INTO #WestCities
    FROM (
    SELECT ID,Description from dbo.WestCities
    Where ID IN (SELECT Value from dbo.SplitStateID(@StateID))
    ) AS B
    SELECT * INTO #Country
    FROM (
    SELECT ID , Description, State,Country From dbo.Country
    ) AS C
    SELECT EC.ID AS East, WC.ID AS West , EC.Description AS EastDesc, WC.Description AS WestDesc, CT.State, CT.Country
    FROM #Country CT
    LEFT JOIN #EastCities EC ON CT.ID=EC.ID
    LEFT JOIN #WestCities WC ON CT.ID=WC.ID
    DROP TABLE #EastCities
    DROP TABLE #WestCities
    DROP TABLE #Country
    END
    Above 3 temp tables are joined by #Country.ID key
    It works fine when single value is passed in @StateID
    Exec dbo.CountrySelection '01/01/2010','02/01/2010',10
    It fails when multi value passed into @StateID
    Exec dbo.CountrySelection '01/01/2010','02/01/2010','10,30,40'
    SSRS error log shows "Must declare scalar variable @StateID"
    Need help in fixing this issue.
    Thanks,
    RH
    sql

    Visakh,
    I changed @StateID date type to varchar(max) and still I get this error.  
    System.Data.SqlClient.SqlException: Must declare the scalar variable "@StateID".
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
    I am running this SO in SSRS quert Type =Text
    Actually sp created on db2 database and due to some limitations I am running(via SSRS) this from different db1 database data source within the same db server. When I run this sp from SSRS query designer(edit query designer button) and pass
    multivalue parameters to @StateID as 10 , 20 it works and gives expected resultset.
    Thanks,
    RH
    sql

  • Best approach to return Large data ( 4K) from Stored Proc

    We have a stored proc (Oracle 8i) that:
    1) receives some parameters.
    2)performs computations which create a large block of data
    3) return this data to caller.
    compatible with both ASP (using MSDAORA.Oracle), and ColdFusion (using Oracle ODBC driver). This procedure is critical in terms of performance.
    I have written this procedure as having an OUT param which is a REF CURSOR to a record containing a LONG. In order to make this work, at the end of the procedure I have to store the working buffer (an internal LONG variable) into a temp table, and then open the cursor as a SELECT from the temp table.
    I have tried to open the cursor as a SELECT of the working buffer (from dual) but I get the error "ORA-01460: unimplemented or unreasonable conversion requested"
    I suspect this is taking too much time; any tips about the best approach here? is there a resource with REAL examples on returning large data?
    If I switch to CLOB, will it speed the process, be compatible with callers, etc ? all references to CLOB I saw use trivial examples.
    Thanks for any help,
    Yoram Ayalon

    We have a stored proc (Oracle 8i) that:
    1) receives some parameters.
    2)performs computations which create a large block of data
    3) return this data to caller.
    compatible with both ASP (using MSDAORA.Oracle), and ColdFusion (using Oracle ODBC driver). This procedure is critical in terms of performance.
    I have written this procedure as having an OUT param which is a REF CURSOR to a record containing a LONG. In order to make this work, at the end of the procedure I have to store the working buffer (an internal LONG variable) into a temp table, and then open the cursor as a SELECT from the temp table.
    I have tried to open the cursor as a SELECT of the working buffer (from dual) but I get the error "ORA-01460: unimplemented or unreasonable conversion requested"
    I suspect this is taking too much time; any tips about the best approach here? is there a resource with REAL examples on returning large data?
    If I switch to CLOB, will it speed the process, be compatible with callers, etc ? all references to CLOB I saw use trivial examples.
    Thanks for any help,
    Yoram Ayalon

  • Creating a java stored proc in jdev

    Does anyone have a quick ref guide to creating a java stored proc in jdev? I am missing early steps to correctly setup the project.
    Thanks in advance.

    Assuming you are using ADF BC, you can try something like the following on your Application Module:
    /* our java method to call a stored procedure to send email */
    public void sendEmail(String fromEmailAddress, String toEmailAddress,
    String subject, String body1, String body2,
    String body3, String body4, String body5) {
    Object[] parms =
    { fromEmailAddress, toEmailAddress, subject, body1, body2, body3,
    body4, body5 };
    callStoredProcedure("MSKCC.proc_send_mail(?,?,?,?,?,?,?,?)", parms);
    protected void callStoredProcedure(String stmt, Object[] bindVars) {
    PreparedStatement st = null;
    try {
    // 1. Create a JDBC PreparedStatement for
    st =
    getDBTransaction().createPreparedStatement("begin " + stmt + ";end;", 0);
    if (bindVars != null) {
    // 2. Loop over values for the bind variables passed in, if any
    for (int z = 0; z < bindVars.length; z++) {
    // 3. Set the value of each bind variable in the statement
    st.setObject(z + 1, bindVars[z]);
    // 4. Execute the statement
    st.executeUpdate();
    } catch (SQLException e) {
    throw new JboException(e);
    } finally {
    if (st != null) {
    try {
    // 5. Close the statement
    st.close();
    } catch (SQLException e) {
    }

  • How to include an out param of a stored proc called inside a ref cursor...????

    I have a stored proc that is defined as
    CREATE or REPLACE
    PROCEDURE ABC
    (linkid IN CHAR,
    Year_in IN DATE,
    Method_in IN CHAR,
    Date_out OUT DATE,
    average_out OUT NUMBER)
    is
    begin
    end;
    another partially completed stored proc that returns a ref
    cursor defined as follows:
    create or replace package zzz
    as
    type cursorType is ref cursor;
    end;
    create or replace function test return zzz.cursortype
    as
    date_OUT date;
    Average_OUT number;
    l_cursor zzz.cursorType;
    CURSOR temp_cur is
    SELECT l.linkid, L.routenumber, ABC(l.linkid,
    to_date('01/01/2000', 'mm/dd/yyyy'),
    '2',
    date_OUT,
    average_OUT)
    FROM LINK l
    WHERE l.LINKID <= '010999';
    begin
    open temp_cur;
    end;
    inside test (which I need help completing), how can I refer to
    the date_out and the average_out params returned by ABC() so
    that these values are in turn passed to the cursortype defined
    in package zzz?
    Thanks in advance.

    Try rewriting your abc proceudre as two functions, abc1 and
    abc2, and rewriting your test function as a test procedure. See
    if you can fill in the blanks prefaced by hyphens -- in the
    following code:
    CREATE OR REPLACE FUNCTION abc1
      (linkid      IN  CHAR,
       year_in     IN  DATE,
       method_in   IN  CHAR)
      RETURN DATE
    IS
      date_out DATE;
    BEGIN
      SELECT   --
      INTO     date_out
      FROM     --
      WHERE    --;
      --or
      date_out := --;
      RETURN date_out;
    END abc1;
    CREATE OR REPLACE FUNCTION abc2
      (linkid      IN  CHAR,
       year_in     IN  DATE,
       method_in   IN  CHAR)
      RETURN NUMBER
    IS
      average_out NUMBER;
    BEGIN
      SELECT   AVG (--)
      INTO     average_out
      FROM     --
      WHERE    --
      GROUP BY --;
      --or
      average_out := --;
      RETURN average_out;
    END abc2;
    CREATE OR REPLACE PACKAGE zzz
    AS
      TYPE cursortype IS REF CURSOR;
      PROCEDURE test
        (temp_cur OUT cursortype);
    END zzz;
    CREATE OR REPLACE PACKAGE BODY zzz
    AS
      PROCEDURE test
        (temp_cur OUT cursortype)
      IS
      BEGIN
        OPEN temp_cur
        FOR
        SELECT l.linkid,
               l.routenumber,
               abc1 (l.linkid,
                    TO_DATE ('01/01/2000', 'mm/dd/yyyy'),
                    '2'),
               abc2 (l.linkid,
                    TO_DATE ('01/01/2000', 'mm/dd/yyyy'),
                    '2')
        FROM   link l
        WHERE  l.linkid <= '010999';
      END test;
    END zzz;
    SQL> VARIABLE g_ref REFCURSOR;
    SQL> EXEC zzz.test (:g_ref);
    SQL> PRINT g_ref

  • Executing a Variable in a Stored Procedure containing an Update Statement

    Hi,
    I have created a Stored Procedure, it has one input parameter. Inside the Stored Procedure there are 5 other variables are declared, based on the input parameter 4 of these variables are populated.
    Fifth variable is a a concatenation of text and some of these variables and creates a dynamic Update Statement. Once it is created I want to execute this variable but it is not executing.
    Could someone please help me in knowing how to execute a variable within a stored procedure that contains an update statement.
    Thanks for your help.
    Thanks
    Vineesh
    vineesh1701

    If you have set up the variable so that it contains a valid sql update, it should work.  For example, see below, which does do an update
    use tempdb
    go
    Create Table #Test(i int);
    Insert #Test(i) Values(1);
    go
    Create Procedure TestProc As
    Begin
    Declare @SQL nvarchar(250);
    Set @SQL = 'Update #Test Set i = 2';
    --Print @SQL;
    Exec sp_executesql @SQL;
    End
    go
    Exec TestProc
    -- Test Result
    Select * From #Test;
    go
    Drop Procedure TestProc;
    go
    Drop Table #Test;
    One thing I would recommend while testing is that you print out or select the variable that contains the dynamic sql.  (Like the above code where I have a print statement.  That lets you see exactly what you are executing and if there is any problem
    with the update command. 
    As Naomi said, to get anything more than general help, you will probably have to show us your code and the parameter values you are passing when you execute the stored proc.
    Tom

  • Clearing Oracle Parameters to call diferent stored procs

    Sub Main
    Do While i < 3
    make_excel(i)
    i = i + 1
    Loop
    end Sub
    Sub make_excel(ByVal array As Integer)
    objCmd.Parameters.Add(New OracleParameter("p_cursor", OracleType.Cursor)).Direction = ParameterDirection.Output
    end Sub
    objCmd.Parameters.Clear()
    objCmd.Parameters.Remove("p_cursor")

    I agree with you. I was looking into mod_plsql, but it turns out that their development standards include not using Oracle HTTP server. The whole reason why they want to be able to execute a stored proc based on what is specified in an XML doc is that they want to avoid having to change their middle-tier configurations anytime a new stored proc or a change in stored proc parameters is made. I'm not familiar with what all is involved with .NET and the middle-tier, but supposedly this way, they can specify any stored procedure name and its parameters in an XML file. The XML is then suppose to be passed on to an Oracle stored procedure which will parse the XML and dynamically execute the stored procedure that was specified in the XML.
    Here is an example of the XML:
    '<Root>
      <PackageName>TEST_PKG</PackageName>
      <ProcedureName>TEST_PROC</ProcedureName>
        <Parameters> 
        <Parameter>
            <Name>EmpID</Name>
            <Value>12345</Value>
        </Parameter>
        <Parameter>
            <Name>Org</Name>
            <Value>ABC</Value>
        </Parameter>
        </Parameters>
    </Root>I basically need to parse out the pkg/proc names:
      SELECT t.COLUMN_VALUE.extract('//PackageName/text()').getstringval() PkgName,
             t.COLUMN_VALUE.extract('//ProcedureName/text()').getstringval() ProcName
         INTO v_pkg_name, v_proc_name
         FROM TABLE(xmlsequence(XMLTYPE(v_XML_input) .extract('/Root'))) t;...and then execute the procedure:
        EXECUTE IMMEDIATE 'BEGIN '||v_pkg_name||'.'||v_proc_name||'(:a, :b, :c); END;'
          using in v_in_param1, v_in_param2, out v_XML_output;The problem is that this approach is very complicated since there can be any number of IN/OUT parameters and of various datatypes. I would have to create all kinds of possible bind variables!

Maybe you are looking for

  • How do I save more than 5 emails in a folder on my iphone 4s?

    How do I save more than 5 emails in a folder on my iphone 4S? It only holds 5! It automatically drops off the oldest, 6th email. Is there a way to hold more?????

  • TV Season download Help, please!

    I have two problems with TV seasons I have downloaded. 1.  I previously downloaded season one of Dr. Who to my iPad.  After watching episodes and syncing to iTunes the already watched episodes would disappear from my iPad freeing up space.  I believe

  • Range of values in a Between-condition?

    Hello all, I need help for the following problem: I have records with a date-field with values from January 1999 till today. In a query I want to select all records where the date-field + 31 to +60 days are between the 1^st^ of January 2000 and the 3

  • Why Won't Permission Repair Repair The Permissions?

    Upgraded to latest iTunes today, 11.1.1, an i get a tone of permission problems. While it says it repaired them, I reboot again and the same thing, it repairs the permissions. Questions. 1. Why is permission repair not repairing the bloody permission

  • Thumbnail view placement

    Ever since new the thumbnail view on my daughters iPad mini has been located on the right hand side. Then just recently it now appears on the left hand side. She must have accidently switched it somehow. Is there a way or preference setting to change