Asynchronous stored proc call in 10g

Hi,
There's an external application that executes one of the stored procedures in my database. I dont want an open connection between the application and database for the duration of procedure execution (execution time can be as long as an hour).
What'd be the best approach to asynchronously call the stored procedure in Oracle 10g?
Also, can I run multiple sessions of the same procedure asynchronously (as the external application is accessible to many users and more than one user can kick-off the process at any point of time).
Any pointers to relevant documentation would be greatly appreciated.
Thanks

Another suggestion can be Streams AQ. I found it very useful.
You can see a working example here:
http://asktom.oracle.com/pls/ask/f?p=4950:8:11739140770566317513::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:8760267539329
All you need to know is here:
http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14257/toc.htm

Similar Messages

  • Error committing transaction in Stored Proc call - prev solns not working

    Hi All,
    Our process invokes a DB adapter to fetch the response from the table for our request via Stored Procedure call but facing the below issue. Its a synchronous process. Stored Procedure is present inside the Package and we are calling the Stored procedure using that Package.
    What we did is created a DB datasource of XA type and tried to call the Stored Proc but it was giving a problem “ORA-24777: use of non-migratable database link not allowed” and hence according to this thread Using DB links in Stored proc call in DB adapter 11G SOA we have modified the datasource as non-XA type.
    While we do that, we could see that Stored Proc is called and the response is present in the reply payload inside the flow trace. But the instance is getting faulted and the error is “Error committing transaction:; nested exception is: javax.transaction.xa.XAException: JDBC driver does not support XA, hence cannot be a participant in two-phase commit. To force this participation, set the GlobalTransactionsProtocol attribute to LoggingLastResource (recommended) or EmulateTwoPhaseCommit for the Data Source.”
    We have tried the properties of global transaction support as one phase commit, emulate two phase commit and logging last resource but error remains the same.
    Database from which we are getting the response is of version "Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production". Will the database link error arises even if we connect to Oracle Database?
    Please could you advise me solutions to resolve this issue.
    Thanks in advance.

    You are using Non-XA because it means (among all others) that the commit issue can be handle by the DB as well.
    The Emulate Two Phase property imitating the XA transaction in that way, that it allows you to manage a local db transaction.
    You can stay with XA connection, but then you will have to use "AUTONOMOUS_TRANSACTION pragma" in your procedure.
    Enter the following link to find good explanation about all of your questions:
    http://docs.oracle.com/cd/E15523_01/integration.1111/e10231/adptr_db.htm#BGBIHCIJ
    Arik

  • Non blocking stored proc call

    HI
    I have written a c application using OCI which can call stored proc. but that is using blocking call. Is it possible to call stored proc in non blocking mode? So that I can receive output in call back function. Actually stored proc take much time to execute can I associate some Subscription callback-function with my stored proc call. Any idea?
    Thanks
    Kamran

    If you want to do non-blocking calls in OCI, you just need to set the server handle (svrhp below) attribute:
    sb2 polling=1;
    OCIAttrSet((dvoid *)svrhp,
    (ub4)OCI_HTYPE_SERVER,
    (dvoid *)&polling,
    (ub4)0,
    (ub4)OCI_ATTR_NONBLOCKING_MODE,
    (OCIError *) errhp);
    And then you call you OCIExecute() as you would in blocking mode. The difference is that instead of blocking until the call is done on the server, it always returns immediately. So instead of calling it just once per statement and checking the return code, you must keep calling OCIExecute() until it does not equal OCI_STILL_EXECUTING. When the proc is done, the final call to OCIExecute() will then be OCI_SUCCESS, OCI_ERROR, whatever happened.

  • ASAP: How a stored proc calls OS(unix)Commands

    urgent!!
    My stored procedure requires to call unix commands HOW DO I DO IT?
    my rqrmnt is :
    stored proc is :-
    1.for each file in a directory($ls)
    do
    2.sql stmnts of insert etc
    /OR
    use sqlldr for the same.
    done.
    ** how do i do both the operations 1&2 in the same Oracle procedure?

    I know HOST can be used in form for OS command but I never thought about doing OS command in the stored procedure.
    Hmm...........
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by [email protected] ... ([email protected]):
    urgent!!
    My stored procedure requires to call unix commands HOW DO I DO IT?
    my rqrmnt is :
    stored proc is :-
    1.for each file in a directory($ls)
    do
    2.sql stmnts of insert etc
    /OR
    use sqlldr for the same.
    done.
    ** how do i do both the operations 1&2 in the same Oracle procedure?
    <HR></BLOCKQUOTE>
    null

  • 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

  • ASAP:stored proc calling Unix commands

    i want an Oracle stored procedure to call unix commands as well as do sqlldr ... opern.
    requirement is :
    the stored procedure needs to do :
    for all files in a Directory:
    do
    { .. use sqlldr to insert data in tbls
    .. move the processed file into another directory
    so,for ls &mv commands i need the Command/way out.
    null

    Hi Jorma,
    It's been a while since I did it, but I successfully did what you
    are trying to do. All I did was "load" the remote interface and
    "stub" class into the database using the "loadjava" utility. My
    environment was Oracle 8.1.7 on SUN (Sparc) Solaris 7.
    Although I haven't tried it, you may be able to invoke a servlet
    from your java stored procedure. The advantage over RMI is that
    you don't need to generate and load a "stub" class. Naturally, you
    would use the "java.net.URLConnection" class to invoke a servlet
    on some web-server/servlet engine which you can communicate with
    using "streams" -- java.io.InputStream and java.io.OutputStream
    Also, I understand that there is now a "oc4jclient.jar" (not 100%
    sure of the name) file that can be "loaded" into the database,
    which allows you to contact EJB's in Oracle's OC4J product. I
    think you can either do this directly, or indirectly using JMS
    over Oracle AQ.
    [JMS = Java Messaging Service]
    [AQ = Advanced Queueing]
    Good Luck,
    Avi.

  • ODP problem Calling Stored proc..

    First here is the code (C#) Errror I am getting is
    (Either wrong number of arguments or right at the execute command it just hangs..)
    OracleConnection oOracleConn = new OracleConnection();
    oOracleConn.ConnectionString = "Data Source=Config;USER ID=xyz;PASSWORD=xyz;";
    oOracleConn.Open();
    OracleCommand myCmd = new OracleCommand("Config.BillerVersionIns", oOracleConn);
    myCmd.CommandType = CommandType.StoredProcedure;
    OracleTimeStamp x = OracleTimeStamp.GetSysDate();
    myCmd.BindByName = true;
    myCmd.Parameters.Add("p_BillerID ", OracleDbType.Int32).Value = 409;
    myCmd.Parameters.Add("p_BillerName", OracleDbType.Varchar2).Value = "TestBiller";
    myCmd.Parameters.Add("p_BillerActiveInd", OracleDbType.Char).Value = "Y";
    myCmd.Parameters.Add("p_ParentBillerID", OracleDbType.Int32);//( this can be null)
    myCmd.Parameters.Add("p_PaymentAcceptanceInd", OracleDbType.Char).Value = "Y";
    myCmd.Parameters.Add("p_VersionDesc", OracleDbType.Varchar2).Value = "Version Number 4";
    myCmd.Parameters.Add("p_EffectiveDate", OracleDbType.TimeStamp).Value = x;
    myCmd.Parameters.Add("o_BillerID", OracleDbType.Int32).Direction = ParameterDirection.Output;
    myCmd.Parameters.Add("o_VersionID", OracleDbType.Int32).Direction = ParameterDirection.Output;
    myCmd.Parameters.Add("o_VersionDesc", OracleDbType.Varchar2).Direction = ParameterDirection.Output;
    myCmd.Parameters[3].Status = OracleParameterStatus.NullInsert;
    OracleDataReader myreader = myCmd.ExecuteReader();
    And now the Stored proc in Oracle 10g...( pls note I have tested this stored proc from Oracle client tool its getting executed perfectly only problem is when I try to call it from code above it throws error)..
    Var v1 Number
    Var v2 Number
    Var v3 Varchar2(50)
    Exec Config.BillerVersionIns (409,'Midwest Energy1', 'Y', NULL, 'Y', 'Version Number 1', SYSDATE, :v1, :v2, :v3)
    Print v1
    Print v2
    Print v3
    Oracle Procs
    TEXT
    Procedure BillerVersionIns
    ( p_BillerID In Number,
    p_BillerName In Varchar2,
    p_BillerActiveInd In Char,
    p_ParentBillerID In Number,
    p_PaymentAcceptanceInd In Char,
    p_VersionDesc In Varchar2,
    p_EffectiveDate In TimeStamp,
    o_BillerID out NOCOPY Number,
    o_VersionID out Number,
    o_VersionDesc out NOCOPY Varchar2
    ) Is
    v_BillerID Number;
    v_VersionID Number;
    v_EffectiveDate TimeStamp;
    v_SysDate TimeStamp;
    Begin
    v_EffectiveDate := p_EffectiveDate;
    v_EffectiveDate := SYSDATE;
    v_SysDate := SYSDATE;
    If (p_BillerID Is Null) Then
    v_VersionID := 1;
    Insert Into Config.Biller(BillerID, BillerName, BillerActiveInd, ParentBillerID, PaymentAcceptanceInd, CreatedDate, UpdatedDate)
    Values (Config.Biller_Seq.NextVal, p_BillerName, p_BillerActiveInd, p_ParentBillerID, p_PaymentAcceptanceInd, v_SysDate, v_SysDate);
    Select BillerID Into v_BillerID From Config.Biller Where BillerName = p_BillerName;
    Insert Into Config.BillerVersion (BillerID, VersionID, BillerName, VersionDesc, BillerVersionActiveInd, EffectiveDate, RetireDate, ParentBillerID, PaymentAcceptanceInd, CreatedDate)
    Values (v_BillerID, v_VersionID, p_BillerName, p_VersionDesc, 'Y', v_EffectiveDate, NULL, p_ParentBillerID, p_PaymentAcceptanceInd, v_SysDate);
    o_BillerID := v_BillerID;
    o_VersionID := v_VersionID;
    Select VersionDesc Into o_VersionDesc From Config.BillerVersion Where BillerID = v_BillerID And VersionID = v_VersionID;
    Else
    Select Max(VersionID) Into v_VersionID From Config.BillerVersion Where BillerID = p_BillerID;
    Update Config.BillerVersion
    Set BillerVersionActiveInd = 'N',
    RetireDate = v_SysDate
    Where BillerID = p_BillerID
    And VersionID = v_VersionID;
    v_VersionID := v_VersionID + 1;
    Update Config.Biller
    Set BillerName = p_BillerName,
    BillerActiveInd = p_BillerActiveInd,
    ParentBillerID = p_ParentBillerID,
    PaymentAcceptanceInd = p_PaymentAcceptanceInd,
    UpdatedDate = v_SysDate
    Where BillerID = p_BillerID;
    Insert Into Config.BillerVersion (BillerID, VersionID, BillerName, VersionDesc, BillerVersionActiveInd, EffectiveDate, RetireDate, ParentBillerID, PaymentAcceptanceInd, CreatedDate)
    Values (p_BillerID, v_VersionID, p_BillerName, p_VersionDesc, 'Y', v_EffectiveDate, NULL, p_ParentBillerID, p_PaymentAcceptanceInd, v_SysDate);
    o_BillerID := p_BillerID;
    o_VersionID := v_VersionID;
    Select VersionDesc Into o_VersionDesc From Config.BillerVersion Where BillerID = p_BillerID And VersionID = v_VersionID;
    End If;
    End;
    69 rows selected
    TEXT
    Message was edited by:
    user588434

    One additional point I would make on the Spring integration side is that you should probably cast to ClientSession below rather than SpringClientSession. Or, in this case, even to oracle.toplink.publicinterface.Session.
    java.sql.Connection conn = ((ClientSession) session).getAccessor().getConnection();
    Or probably even better would be to refactor the code so that you can execute a DatabaseQuery with a stored procedure Callable. Although I know you already said that you inherited this code from somewhere else, so maybe there's nothing you can do.
    But in general, I try to do whatever I can to avoid having to extract the Connection from a TopLink Session.

  • Can we call a Java Stored Proc from a PL/SQL stored Proc?

    Hello!
    Do you know how to call a Java Stored Proc from a PL/SQL stored Proc? is it possible? Could you give me an exemple?
    If yes, in that java stored proc, can we do a call to an EJB running in a remote iAS ?
    Thank you!

    For the java stored proc called from pl/sql, the example above that uses dynamic sql should word :
    CREATE OR REPLACE PACKAGE MyPackage AS
    TYPE Ref_Cursor_t IS REF CURSOR;
    FUNCTION get_good_ids RETURN VARCHAR2 ;
    FUNCTION get_plsql_table_A RETURN Ref_Cursor_t;
    END MyPackage;
    CREATE OR REPLACE PACKAGE BODY MyPackage AS
    FUNCTION get_good_ids RETURN VARCHAR2
    AS LANGUAGE JAVA
    NAME 'MyServer.getGoodIds() return java.lang.String';
    FUNCTION get_plsql_table_A RETURN Ref_Cursor_t
    IS table_cursor Ref_Cursor_t;
    good_ids VARCHAR2(100);
    BEGIN
    good_ids := get_good_ids();
    OPEN table_cursor FOR 'SELECT id, name FROM TableA WHERE id IN ( ' &#0124; &#0124; good_ids &#0124; &#0124; ')';
    RETURN table_cursor;
    END;
    END MyPackage;
    public class MyServer{
    public static String getGoodIds() throws SQLException {
    return "1, 3, 6 ";
    null

  • Java stored proc from proxy Java classes generated from a web service?

    Hi gurus,
    I have searched "Java Stored Procedure" on this forum but could not find what I am looking for, so I have to post again.
    I need to use a web service and my client app is written in PowerBuilder 11 (Sybase), which claims that it will create a datawindow from a web service. Well, it turned out that PB can only handle simple stuff (it works with a very simple wsdl from the internet) but can't handle more complex ones that we need to use. So I am thinking about using Oracle JDeveloper(JDev) to create the web service proxy for the web service and then load it into Oracle as a Java stored procedure so that PowerBuilder can call the procedure. JDev succsfully generated the proxy and a few Java classes. My question is, do I need to load all the classes into the database? If yes, will the reference to the package work? For example, in a JDev generated class (the soap client class), it has package MyJdev.proxy; at the top. Or, will it work if I load all the classes included in package /MyJdev/proxy into the database?
    Thank you very much for any help.
    Ben

    For the java stored proc called from pl/sql, the example above that uses dynamic sql should word :
    CREATE OR REPLACE PACKAGE MyPackage AS
    TYPE Ref_Cursor_t IS REF CURSOR;
    FUNCTION get_good_ids RETURN VARCHAR2 ;
    FUNCTION get_plsql_table_A RETURN Ref_Cursor_t;
    END MyPackage;
    CREATE OR REPLACE PACKAGE BODY MyPackage AS
    FUNCTION get_good_ids RETURN VARCHAR2
    AS LANGUAGE JAVA
    NAME 'MyServer.getGoodIds() return java.lang.String';
    FUNCTION get_plsql_table_A RETURN Ref_Cursor_t
    IS table_cursor Ref_Cursor_t;
    good_ids VARCHAR2(100);
    BEGIN
    good_ids := get_good_ids();
    OPEN table_cursor FOR 'SELECT id, name FROM TableA WHERE id IN ( ' &#0124; &#0124; good_ids &#0124; &#0124; ')';
    RETURN table_cursor;
    END;
    END MyPackage;
    public class MyServer{
    public static String getGoodIds() throws SQLException {
    return "1, 3, 6 ";
    null

  • Oracle stored procedure call failed,but not captured by the error handling

    Hi All,
    I have a unix shelll script which calls a stored proc in Oracle, the stored proc call failed due to "ORA-01033: ORACLE initialization or shutdown in progress".
    But it is not captured in the error handling block, Any ideas why this had happened?
    SQL file had : my_test_sql.sql
    exec my_proc(..............);
    Unix shell script has this call:
    sqlplus -s my_user/my_pwd@db1 @my_test_sql.sql
    if [[ $? -ne 0 ]]; then
    echo "failed"
    exit 1
    else
    echo "success"
    fi
    If i execute the above shell, I'm getting the following
    ERROR:
    ORA-01033: ORACLE initialization or shutdown in progress
    SP2-0306: Invalid option.
    Usage: CONNÝECT¨ Ýlogon¨ ÝAS SYSDBA¨
    where <logon> ::= <username>Ý/<password>¨Ý@<connect_identifier>¨ | /
    success.
    This puzzled me, any pointers?

    The $? status variable shows the return code of the last command executed. It will be difficult to determine what the exit status of your sql script is without knowing the script. Do you have any "WHENEVER SQLERROR EXIT" statements in the script?
    The ORA-01033 error happens when the database is not open, perhaps in recovery, or startup or shutdown is halted due to a failed or full disk, error in archiving or writing to redo, etc.

  • WCF OData Service stored procedure call generates "Operation could destabilize the runtime" error with $select option

    I've been trying to call a stored procedure through Entity Framework and WCF Data Services (OData). It returns an entity not a complex type. Following walkthroughs found all over the web, I came up with this code inside my service:
    [WebGet]
    public IQueryable<Entity> GetEntitiesByParameterId(int parameterId)
    return CurrentDataSource.GetEntitiesByParameterId(parameterId).AsQueryable();
    Calling the proc this way: ~WcfService.svc/GetEntitiesByParameterId?parameterId=1 executes
    the stored procedure and returns entities that should be returned. No problem there.
    Everything works well until I try to use $select OData option ie. ~WcfService.svc/GetEntitiesByParameterId?parameterId=1&$select=name.
    Upon debugging, the method above runs without any error but it returns an Operation could destabilize the runtime error upon reaching the
    client. After so much research, apparently it is a very general error pointing to a lot of different causes. I haven't found one that really matches my particular problem. Closest are 
    http://stackoverflow.com/questions/378895/operation-could-destabilize-the-runtime
    https://social.msdn.microsoft.com/Forums/en-US/d2fb4767-dc09-4879-a62a-5b2ce96c4465/for-some-columns-entity-properties-executestorequery-failed-with-error-operation-could?forum=adodotnetdataservices 
    but none of the solutions worked on my end.
    Also, from the second article above:
    This is a known limitation of WCF DS. ...
    Second is that some of the queries won't work correctly because LINQ to EF needs little different LINQ expressions than LINQ to Objects in some cases. Which is the problem you're seeing.
    It has been posted on 2012. If it its true, are there still no updates on this? And is there any other workaround to get the $select working on the stored proc call?
    What works:
    ~WcfService.svc/GetEntitiesByParameterId?parameterId=1
    ~WcfService.svc/GetEntitiesByParameterId?parameterId=1&$top=1
    ~WcfService.svc/GetEntitiesByParameterId?parameterId=1&$skip-5
    ~WcfService.svc/GetEntitiesByParameterId?parameterId=1&$filter={filter query}
    ~WcfService.svc/GetEntitiesByParameterId?parameterId=1&$expand=SomeNavigationProperty
    What doesn't work:
    ~WcfService.svc/GetEntitiesByParameterId?parameterId=1&$select=name
    Tech details:
    EntityFramework 5, WCF Data Service 5.0, OData V3
    *I've also tried upgrading to EF6 and WCF 5.6.2 and it still didn't work.
    Any help would be appreciated. Thanks!

    Someone from SO replied to my question there and said that $select is still not supported though I couldn't find any definitive documentation about it.
    From what I gather and observed, $select breaks the stored procedure call because it tries to alter the data shape already gotten from the database and attempts to return a dynamic entity instead. Something about the stored proc returning an ObjectResult might
    be messing it up. As I have said, these are merely my observations.
    Workaround: I found a simple and elegant workaround for it though. Since my stored procedures are only getting data from the database and does
    not alter data in any way (INSERT, UPDATE, DELETE), I tried using table-valued functions that returns a table equivalent to the entity on my EF. I've found that calling this function on the Service Operation method returns an IQueryable<Entity> which
    is basically what is needed. $select also works now and so does other OData query options.
    Steps:
    Create a function on the database
    Update EDMX -> Add function
    Add new Function Import with Entity return type
    Create service operation in WCF Data Service that calls CurrentDataSource.<FunctionName>()
    Test in fiddler.
    CODES
    Database Function:
    CREATE FUNCTION GetEntities(@parameter)
    RETURN @entites TABLE(
    [Id] [int],
    [Name] [nvarchar](100),
    AS
    BEGIN
    INSERT INTO @entities
    SELECT [Id], [Name], ... FROM [EntityTable]
    RETURN
    END
    WCF:
    [WebGet]
    public IQueryable<Entity> GetEntity(int parameter)
    return CurrentDataSource.GetEntity(parameter);
    It doesn't really solve the stored procedure problem but I'm marking this as answer until someone can provide a better one as it does solve what I'm trying to do.
    Hope this helps others too. :)

  • DATE value in a STORED PROC becoming incorrect?

    I have a PL SQL script that creates a TABLE on the fly with a DATE column in it. I then have a FUNCTION that queries this table. The FCN is called from within a SP. In these three steps the date becomes a BOGUS value.... I am seeing things like this:
    2/5/0009 12:00:00.000 AM
    6/4/0009 12:00:00.000 AM
    4/16/0009 12:00:00.000 AM
    7/9/0008 12:00:00.000 AM
    5/7/0007 12:00:00.000 AM
    Obviously the 0009 should be 2009 and 0008 2008 etc..... ANy idea what is causing this?????
    Here is my code:
    DROP TABLE MAXIMO.MAX411_TEMP_REG_DATE
    create table
       MAXIMO.MAX411_TEMP_REG_DATE
    as
    SELECT  ITEMNUM,
            DESCRIPTION,
            LOCATION,
            BINNUM,
            REG_DATE + (trunc(rownum / ((select count(*) from inventory)/100))*7) REG_DATE
    FROM ( SELECT   I.ITEMNUM,
                    I.DESCRIPTION,
                    N.LOCATION,
                    N.BINNUM,
                    TO_DATE(SYSDATE,'DD-MON-YYYY') REG_DATE
            FROM ITEM I, INVENTORY N
            WHERE I.ITEMNUM = N.ITEMNUM
            ORDER BY N.LOCATION, N.BINNUM)
    COMMIT
    CREATE OR REPLACE FUNCTION MAXIMO.FCN_GET_REGDATE (item_in IN VARCHAR2)
      RETURN DATE
    IS
      new_regdate   DATE;
      var_problem_indicator   number;
      BEGIN
              SELECT reg_date
               INTO new_regdate
               FROM MAXIMO.MAX411_TEMP_REG_DATE
               WHERE itemnum = TRIM(item_in) AND ROWNUM = 1;
      END;
    RETURN new_regdate;
    END;
    / STORED PROC CALL
    var_regdate             DATE;
    var_regdate := MAXIMO.FCN_GET_REGDATE (rec.ITEMNUM);Thanks for any help I can get.....
    Miller

    Looking at this code I find two items very disturbing:
    ORDER BY N.LOCATION, N.BINNUM
    ... and ...
    WHERE itemnum = TRIM(item_in) AND ROWNUM = 1;
    It looks a lot like you are trying to rely on a sort order imposed on the data as it is inserted into the table to identify a particular record for a given item_in. If so, that's very dangerous, but it's nothing that can't be fixed. Let us know ...

  • Is there a way to call a stored proc from the web in Oracle 10g?

    I've found an article about Native Oracle XML DB Web Services in 11g, but it appears to be a new feature. Is there any way of accomplishing something similar in 10g? I would like to be able to process XML documents that contain the name and parameters of the stored proc/function to execute.
    Link to 11g article:
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28369/xdb_web_services.htm

    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!

  • Call stored proc

    Hello!
    We use TT as CacheConnect to Oracle Database 10g. Can we call Oracle Database 10g stored proc from our C++ application? Than passthrough level we must to use if we can perform this call?
    Thank you!

    You can call Stored procedures using PassThrough=3 provided that the procedure does not return any values.
    Note that the procedure will execute in Oracle against Oracle data not against TimesTen data.
    Chris

  • 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.

Maybe you are looking for

  • How to create Raid 1 on Solaris 10 step by step by DVD Media?

    Please help me figure out "How to create Raid 1 on Solaris 10 6/06 while installation?" The system is Sun Fire X2100 Thank you very much.

  • Problem to convert a optionset into multi selection picklist on crm 2013

    Hey I meet a problème on my development see my result : link : https://social.microsoft.com/Forums/getfile/652331 a multiple select list on my crm 2013 I do this process on this forum : link : https://social.microsoft.com/Forums/en-US/2db47a59-165d-4

  • 2811 service module compatability

    Hi, Will a Cisco NM-2FE2W Network Module work in a 2811 router and if so what are the commands to set it up? I know how to setup T1 controllers but is this the same or similar or what? (presuming the module will work?) Thanks!

  • Huge nsa trace files in 11.2

    Dear all, 11.2.2 rac one node on windows 2008. We are using Physical standby for this too. We have huge generation of trace files in the rdbms/trace directory with the below name medtdw_2_nsa2_7644 contents of the file are : Trace file C:\APP\ORAADMI

  • Nokia n97, iCal calendar sync

    Hi guys, I have an N97 phone (witch with all his small problems and Smbian issues is quite good and a very good otption in terms of an organiser / mobile email / smartphone) and I am trying to sync the calendar with a iCal (.ics) feed from a GTD (Get