Stored Procedure not compiling

Hi,
I am not able to compile stored proc in oracle 8i,
whenever I compile the SP, the pl/sql devloper getting hanged..
I also tried to compile it from sqlplus, even sqlplus is getting hanged.
No SP/Functions are dependent on this SP.
Plz help, Its urgent
Thanks,
Shailesh

Please try this approach:
First SQL*Plus session:
select sid from v$mystat where rownum < 2
compile procedure
Second SQL*Plus session:
select *
from v$session_wait
where sid = your_sid_from_previous_session
This will enable you to find out the reason why you are waiting
Best Regards
Krystian Zieja / mob

Similar Messages

  • Stored procedure not found when creating a new recordset binding in Dreamweaver CS6 with ColdFusion Server 11

    Stored procedure not found when creating a new recordset binding in Dreamweaver CS6 with ColdFusion Server 11.  I can see the tables and views in the database tab, but no stored procedures.  If I connect to a data source created in ColdFusion Server 6 I am able to see the stored procedures.

    Ben thanks for the reply!
    Yes that is the process I am following:
    In Dreamweaver, open the page that will run the stored procedure.
    In the Bindings panel (Window > Bindings), click the Plus button, and then select Stored Procedure.
    In the Data Source pop‑up menu, select a connection to the database containing the stored procedure
    Enter the ColdFusion Data Source user name and password.
    At this point in the procedure drop down I would get a message that said No Stored Procedure Found.
    Right now it appears to be working, I had to create a new site that pointed to the older CF 6 server's data source and create a page following the process above, then when I went back to the CF 11 site the stored procedures were now populated.  I need to make sure it is pulling from the correct server but right now it appears to be working.
    Thanks
    Dwight

  • Stored procedures not working after migrating from 8i to 10g

    The Oracle stored procedures are generating an error following upgrading a ColdFusion web application from Oracle8i to 10g release 2.
    "Error","jrpp-102","05/28/08","13:35:09","insite","Error Executing Database Query.[Macromedia][Oracle JDBC Driver][Oracle]ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'S_DEFAULT_LETTER_SETTING' ORA-06550: line 1, column 7: PL/SQL: Statement ignored The specific sequence of files included or processed is: new_letter.cfm, line: 63 "
    I've been looking at this for about 3 days with a colleague in the office. We can resolve this be recreating the stored procedure with a new name (e.g. adding the suffix "_v2"). Its not really practical for us to do this throughout the system. Anyone know what the root cause might be?
    I'm currently connecting to Oracle10g using SQLTools and Oracle8 client. I've yet to upgrade to Oracle10 client.
    I've tried selecting all the stored procedures and re-compiling them but it appeared to make no difference.

    The Oracle stored procedures are generating an error following upgrading a ColdFusion web application from Oracle8i to 10g release 2.
    "Error","jrpp-102","05/28/08","13:35:09","insite","Error Executing Database Query.[Macromedia][Oracle JDBC Driver][Oracle]ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'S_DEFAULT_LETTER_SETTING' ORA-06550: line 1, column 7: PL/SQL: Statement ignored The specific sequence of files included or processed is: new_letter.cfm, line: 63 "
    I've been looking at this for about 3 days with a colleague in the office. We can resolve this be recreating the stored procedure with a new name (e.g. adding the suffix "_v2"). Its not really practical for us to do this throughout the system. Anyone know what the root cause might be?
    I'm currently connecting to Oracle10g using SQLTools and Oracle8 client. I've yet to upgrade to Oracle10 client.
    I've tried selecting all the stored procedures and re-compiling them but it appeared to make no difference.

  • Exec stored procedure from another stored procedure - not working

    Hey, we've got a bunch of .sql files that we run, and some of them are stored procedures. Our programs call the stored procedures from within the .sql files and that works, but we've tried calling a stored procedure from another stored procedure and it won't compile. The syntax looks the same, and we can run that second stored procedure from the SQL*Plus command prompt just fine, so we know it's in there. It doesn't matter whether we type exec or execute in the first stored procedure--it still gives us a compilation error. Here's the relevant bit of the code:
            delete CMHISTORYINDEX;
            commit;
            exec SP_DAILY_TOTAL;
    END SP_DAILY_CLOSING;
    /Here's where we go into SQL*Plus and try to compile it:
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
    With the Partitioning, Real Application Clusters, OLAP and Data Mining options
    SQL> @sp_daily_closing.sql
    Warning: Procedure created with compilation errors.
    SQL> show errors
    Errors for PROCEDURE SP_DAILY_CLOSING:
    LINE/COL ERROR
    34/7     PLS-00103: Encountered the symbol "SP_DAILY_TOTAL" when expecting
             one of the following:
             := . ( @ % ;
             The symbol ":=" was substituted for "SP_DAILY_TOTAL" to continue.
    SQL>We've also tried changing SP_DAILY_CLOSING to lowercase, but it doesn't seem to help. As I mentioned before, we can type that same sort of thing in .sql files that are not stored procedures and the exec is compiled fine and runs correctly. What are we doing wrong?

    In the stored procedure remove "exec" :
            delete CMHISTORYINDEX;
            commit;
            SP_DAILY_TOTAL;
    END SP_DAILY_CLOSING;

  • Insert Stored Procedure not working

    I'm trying to insert some data, using a stored procedure. I cannot see what seems to be the problem in my procedure.
    PROCEDURE SP_INSPROCDETAILS(I_INITD IN INITIATIVEMASTER.INITIATIVEID%TYPE,
    -- I_INITD = 5414
    I_CNTID IN COUNTRYMASTER.COUNTRYID%TYPE,
    -- I_CNTID = 5
    I_USERID IN USERMASTER.USERID%TYPE,
    -- I_USERID = 5405
    I_DETAIL IN VARCHAR2,
    -- STRING THATWILL COME FROM UI
    -- I_DETAIL = #10414~1234567890~1234567890~test-PONumber~1~1~1~5128~Executor for PO1
    I_DELIMITER_FIRST IN VARCHAR2, -- '~'
    I_DELIMITER_SECOND IN VARCHAR2, - '#'
    O_ERRCODE OUT VARCHAR2,
    O_ERRMSG OUT VARCHAR2)
    IS
    ARR_STRING VAR_TAB;
    ARR_STRING2 VAR_TAB;
    V_ID NUMBER;
    VAR_ESTIMATEDDATE VARCHAR2(500);
    VAR_DODATE VARCHAR2(500);
    V_INITID INITIATIVEDETAILS.INITDETAILSID%TYPE;
    V_INTRANET USERMASTER.INTRANETID%TYPE;
    V_CNT NUMBER;
    V_CREATED PROCUREMENTDETAILS.CREATEDBY%TYPE;
    V_DATE PROCUREMENTDETAILS.CREATEDDATE%TYPE;
    VAR_FLOAT PROCUREMENTDETAILS.POPRICE%TYPE;
    VAR_REPLACE VARCHAR2(500);
    BEGIN
    ---SELECT INITDETAILSID FROM INITIATIVE AND COUNTRY
    SELECT INTD.INITDETAILSID
    INTO V_INITID
    FROM INITIATIVEDETAILS INTD
    WHERE INTD.INITIATIVEID = I_INITD AND ( INTD.COUNTRYID = I_CNTID
    OR INTD.COUNTRYID IS NULL);
    --SELECT INTRANETID FROM USERID
    SELECT U.INTRANETID
    INTO V_INTRANET
    FROM USERMASTER U
    WHERE U.USERID = I_USERID;
    ---CHECKING IF DATA IS PRESENT IN PROCUREMENT TABLE IF PRESNT THEN DELETE AND REINSERT IT
    SELECT COUNT(*)
    INTO V_CNT
    FROM PROCUREMENTDETAILS PC
    WHERE PC.INITDETAILSID = V_INITID;
    IF V_CNT > 0 THEN
    --TAKING THE CREATEDBY AND CREATEDDATE FOR THAT INITIATIVEDETAILSID
    SELECT DISTINCT PC.CREATEDBY, PC.CREATEDDATE
    INTO V_CREATED, V_DATE
    FROM PROCUREMENTDETAILS PC
    WHERE PC.INITDETAILSID = V_INITID;
    DELETE FROM PROCUREMENTDETAILS PC WHERE PC.INITDETAILSID = V_INITID;
    ARR_STRING := PKG_COMMON.SPLIT_LIST_STRING(I_DELIMITER => I_DELIMITER_SECOND,
    I_STRING => I_DETAIL);
    FOR I IN 1 .. ARR_STRING.COUNT LOOP
    IF ARR_STRING(I) IS NOT NULL THEN
    ARR_STRING2 := PKG_COMMON.SPLIT_LIST_STRING(I_DELIMITER => I_DELIMITER_FIRST,
    I_STRING => ARR_STRING(I));
    VAR_DODATE :=ARR_STRING2(3);
    VAR_ESTIMATEDDATE :=ARR_STRING2(8);
    VAR_FLOAT := REPLACE (ARR_STRING2(5),',',NULL) ;
    VAR_REPLACE := REPLACE (ARR_STRING2(6),',',NULL);
    SELECT SEQ_PROCUREMENTDETAILS.NEXTVAL INTO V_ID FROM DUAL;
    INSERT INTO PROCUREMENTDETAILS
    (PROCUREMENTID,
    INITDETAILSID,
    POSMID,
    PONUMBER,
    GL,
    IO,
    POQTY,
    POPRICE,
    POVALUE,
    SUPPLIERID,
    EXECUTOR,
    CREATEDBY,
    CREATEDDATE,
    MODIFIEDBY,
    MODIFIEDDATE)
    VALUES
    (V_ID,
    V_INITID,
    ARR_STRING2(1),
    ARR_STRING2(2),
    ARR_STRING2(3),
    ARR_STRING2(4),
    ARR_STRING2(5),
    ARR_STRING2(6),
    ARR_STRING2(7),
    ARR_STRING2(8),
    ARR_STRING2(9),
    V_CREATED,
    V_DATE,
    V_INTRANET,
    SYSDATE);
    VAR_FLOAT :=NULL;
    END IF ;
    END LOOP;
    ELSE
    ARR_STRING := PKG_COMMON.SPLIT_LIST_STRING(I_DELIMITER => I_DELIMITER_SECOND,
    I_STRING => I_DETAIL);
    FOR I IN 1 .. ARR_STRING.COUNT LOOP
    IF ARR_STRING(I) IS NOT NULL THEN
    ARR_STRING2 := PKG_COMMON.SPLIT_LIST_STRING(I_DELIMITER => I_DELIMITER_FIRST,
    I_STRING => ARR_STRING(I));
    VAR_DODATE :=ARR_STRING2(3);
    VAR_ESTIMATEDDATE :=ARR_STRING2(8);
    VAR_FLOAT := REPLACE (ARR_STRING2(5),',',NULL) ;
    VAR_REPLACE := REPLACE (ARR_STRING2(6),',',NULL);
    SELECT SEQ_PROCUREMENTDETAILS.NEXTVAL INTO V_ID FROM DUAL;
    INSERT INTO PROCUREMENTDETAILS
    (PROCUREMENTID,
    INITDETAILSID,
    POSMID,
    PONUMBER,
    GL,
    IO,
    POQTY,
    POPRICE,
    POVALUE,
    SUPPLIERID,
    EXECUTOR,
    CREATEDBY,
    CREATEDDATE,
    MODIFIEDBY,
    MODIFIEDDATE)
    VALUES
    (V_ID,
    V_INITID,
    ARR_STRING2(1),
    ARR_STRING2(2),
    ARR_STRING2(3),
    ARR_STRING2(4),
    ARR_STRING2(5),
    ARR_STRING2(6),
    ARR_STRING2(7),
    ARR_STRING2(8),
    ARR_STRING2(9),
    V_CREATED,
    V_DATE,
    V_INTRANET,
    SYSDATE);
    END IF ;
    END LOOP;
    END IF ;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    O_ERRCODE := 'E001';
    O_ERRMSG := 'ERROR ' || TO_CHAR(SQLCODE) || ': ' || SQLERRM;
    WHEN OTHERS THEN
    O_ERRCODE := 'E005';
    O_ERRMSG := 'ERROR ' || TO_CHAR(SQLCODE) || ': ' || SQLERRM;
    END SP_INSPROCDETAILS;

    Hi,
    I cannot see what seems to be the problem in my procedure.Hmm.. i cannot see the procedure at all.
    Next time please format your code.
    And you should have mentioned the problem as My procedure does not compile
    When you say problem there are N possibilities (n tends to infinity)
    Anyway, in your case
    I_DELIMITER_SECOND IN VARCHAR2, - '#'What is this doing in teh parameters?
    Either make it as default or comment it completely. like this
    I__DELIMITER_SECOND IN VARCHAR2, -- '#'Hope that helps.
    Regards,
    Bhushan

  • JDBC stored procedure not working in Weblogic 12.1.3

    Hi,
    We are migrating from WLS 12.1.2 to 12.1.3.
    We have a JDBC stored procedure which used to work correctly under 12.1.2. I understand that 12.1.2 uses ojdbc5/ojdbc6 jars (11.2.0.x). After migrating to 12.1.3, the stored procedure is not working.
    We have narrowed it down to the different between 12.1.2 using ojdbc5/6 and 12.1.3 using ojdbc7 jars, though we do not understand what the difference here is.
    Connection connection = getConnection();
    CallableStatement callableStatement = connection.prepareCall("{call RECEIPT_LOG (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
    callableStatement.registerOutParameter("PIO_RECEIPT_LOG_ID", java.sql.Types.INTEGER);
    callableStatement.setLong("PIO_RECEIPT_LOG_ID", 0);
    callableStatement.setString("PIO_DRAWER_NAME", request.getDrawerName());
    callableStatement.setString("PIO_DRAWER_FIRST_NAME", request.getDrawerFirstName());
    callableStatement.setString("PIO_DRAWER_OTHER_NAMES", "");
    callableStatement.setString("PIO_DRAWER_STREET_NO", "");
    callableStatement.setString("PIO_DRAWER_STREET", "");
    callableStatement.setString("PIO_DRAWER_LOCALITY", "");
    callableStatement.setLong("PIO_DRAWER_POSTCODE", 0);
    callableStatement.setString("PI_PAYMENT_TYPE", request.getPiPaymentType());
    callableStatement.setLong("PI_APPLICATION_ID", request.getApplicationId());
    callableStatement.setString("PI_PRIMARY_ID", request.getPiPrimaryId());
    callableStatement.setString("PI_SECONDARY_ID", request.getPiSecondaryId());
    callableStatement.setDouble("PI_AMOUNT", request.getPiAmount());
    callableStatement.setInt("PI_TAX_AMOUNT", 0);
    callableStatement.setNull("PI_VPC_TXNRESPONSECODE", java.sql.Types.VARCHAR);
    callableStatement.setInt("PI_VPC_TRANSACTIONNO", 0);
    callableStatement.setString("PI_VPC_MESSAGE", "");
    callableStatement.setString("PI_VPC_ACQRESPONSECODE", "");
    callableStatement.setString("PI_VPC_RECEIPTNO", "");
    callableStatement.setString("PI_VPC_BATCHNO", "");
    callableStatement.setString("PI_VPC_CARD", "");
    callableStatement.setString("PI_VPC_MERCHTXNREF", "");
    callableStatement.setString("PI_VPC_MERCHANT", "");
    callableStatement.setString("PI_VPC_ORDERINFO", "");
    callableStatement.setInt("PI_VPC_AMOUNT", 0);
    callableStatement.setString("PI_VPC_AUTHORIZEID", "");
    callableStatement.registerOutParameter("PO_RECEIPT_NO", java.sql.Types.VARCHAR);
    callableStatement.registerOutParameter("PO_SOURCE_ID", java.sql.Types.INTEGER);
    callableStatement.registerOutParameter("PO_PAYMENT_METHOD_TEXT", java.sql.Types.VARCHAR);
    callableStatement.registerOutParameter("PO_CREATE_COMMENT", java.sql.Types.VARCHAR);
    callableStatement.registerOutParameter("PO_ERROR_MESSAGE", java.sql.Types.VARCHAR);
    boolean isSuccessful = callableStatement.execute();
    Long receiptLogId = callableStatement.getLong("PIO_RECEIPT_LOG_ID");
    Here, when the callableStatement.execute() is fired, the isSuccessful is false and the output parameter receiptLogId is 0
    Any help appreciated.
    Regards,
    Rahul

    Hi All,
    We still haven't figured out what the problem is with JDBC when using ojdbc7.jar but, as an alternate solution we ported the code to Spring JDBC and got it working.
    Regards,
    Rahul

  • Stored Procedure not excecuted successfully

    hy all
    i got the exception while calling the my stored procedure.from java code....can any one help me to what the issue is occurs ...for this exception...
    my procedure is executes successfully in sql server 2005 database.....but while calling from the java code it gives me following exception...
    //java code...
    con=DriverManager.getConnection(url+dbName, user, psw);
              // CallableStatement cstmt = con.prepareCall("{call dbo.GetCapchaData(?, ?)}");
              CallableStatement cs = con.prepareCall("{? = call GetCapchaData(?)}");
              cs.registerOutParameter(1,java.sql.Types.VARCHAR );
              cs.setString(2, firstname);
    System.out.println("VLAUES OF THE CALLEBALE QUERY");
              cs.execute();
              String retValue = cs.getString(1);
    ..get the following exception.....
    com.microsoft.sqlserver.jdbc.SQLServerException: Procedure or function 'GetCapchaData' expects parameter '@code1', which was not supplied.
         at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
         at com.microsoft.sqlserver.jdbc.IOBuffer.processPackets(Unknown Source)
         at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.getPrepExecResponse(Unknown Source)
         at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
         at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PreparedStatementExecutionRequest.executeStatement(Unknown Source)
         at com.microsoft.sqlserver.jdbc.CancelableRequest.execute(Unknown Source)
    //this my stored procedure code..
    set ANSI_NULLS ON
    set QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[GetCapchaData]
         @FirstName VARCHAR(50) ,
    @code1 VARCHAR(50) OUTPUT
    AS
    BEGIN
         SET NOCOUNT ON;
    SELECT @code1 = code
    FROM dbo.EmployeeDetail
    WHERE fname = @FirstName
    END

    Hy all
    i find the solution.....using following code....
    con=DriverManager.getConnection(url+dbName, user, psw);
    // CallableStatement cs = con.prepareCall("{? = call GetCapchaData(?)}");
              CallableStatement cs = con.prepareCall("{call dbo.GetCapchaData(?,?)}");//use this code instead of above.....line
              cs.setString(1, firstname);
              cs.registerOutParameter(2,java.sql.Types.VARCHAR );
              cs.execute();
              String retValue = cs.getString(2);
    if someone get this type of error they can use it.......
    Thanks
    Yatin Baraiya

  • Oracle Stored Procedure not working

    Hi Guy's,
    I want to connect directly from Visual Composer to Oracle Database 10.2.x.x using Oracle Stored Procedure and JDBC System to demonstrate how easy you can show data vith VC. So I have created a simple Oracle Stored Procedure, a JDBC System with a valid alias, User mapping (Portal User --> Oracle User).
    When I invoke the stored procedure I receive the following error: "Portal request Failed (Could not execute stored procedure)". The Stored Procedure is working fine in Oracle iSQL*Plus.
    Any idea's?
    Thanks,
    Ridouan

    Hi,
    did you use the portal JDBC as it is described here:
    <a href="https://wiki.sdn.sap.com/wiki/display/VC/Cannotseetables">https://wiki.sdn.sap.com/wiki/display/VC/Cannotseetables</a>
    Best Regards,
    Marcel

  • UCCX 8 - Custom Stored Procedure Not Functioning

    Hello,
    We're trying to modify one of the agent summary reports in UCCX 8.  We want the outbound report to only show numbers that were external calls.  (Longer than 4 digits.)  We copied and modified the existing stored procedure and it seems to run ok until we try to use it in the historical reporter.  HR reports that the stored procedure cannot be found.  We've followed what documentation we could find about adding one but can't get it working.  We've been using ASG Server Studio to access the database.  We opened a TAC case but haven't gotten anywhere.  Here's the detail we gave them.
    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-qformat:yes;
    mso-style-parent:"";
    mso-padding-alt:0in 5.4pt 0in 5.4pt;
    mso-para-margin:0in;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-ascii-font-family:Calibri;
    mso-ascii-theme-font:minor-latin;
    mso-fareast-font-family:"Times New Roman";
    mso-fareast-theme-font:minor-fareast;
    mso-hansi-font-family:Calibri;
    mso-hansi-theme-font:minor-latin;
    mso-bidi-font-family:"Times New Roman";
    mso-bidi-theme-font:minor-bidi;}
    I have created a stored procedure on the informix DB for UCCX 8. i have
    been following the Historical reporting admin guide. the SP runs fine when i use ASG
    server studio. when i try to use crystal reports to access the SP i get "Failed to
    retrieve data from the database. Details: ADO Error code 0x80004005 Source: Microsoft OLE
    DB Provider for ODBC Drivers Description: [Informix][Informix ODBC Driver][Informix]
    Routine (sp_agent_call_summar_nointernal) can not be resolved. SQL State:S1000"
    if i use a standard procedure Crystal Reports works fine.
    i have the uccxHrUserRole assigned to the procedure so i do not understand why i cannot
    run the SP.
    Any ideas, we really need to get this working.
    Thanks!

    Hi
    1) There are an impressive number of bugs in early 8.0 versions; on the initial release permissions were incorrect for the existing SPs so the uccxHrUser couldn't run them. You could copy them, so had to copy them and run the copies.. tedious.
    If you are on a working version, the other gotcha is that you need to specify them fully-qualified - so sp-test would be  db_cra.dbo.sp_test
    Also note that the SPs are randomly split between 'functions' and 'procedures' (there may be a pattern, but I can't work it). Both are similar, but there is a field in the DB that marks a proc as a fucntion or a procedure - the informix Squirrel SQL  plugin doesn't work well with this and just shows the ones marked as 'procedures'. I've had better luck with RazorSQL and have recently played  with the free IBM Data Studio which I think also displayed them all.
    2) You can't edit the permissions of existing ones, but you can add new ones and since you (well, uccxHrUser) is the owner you can set permissions on those. Try using RazorSQL or AGS Server Studio (which is better, but $$$) to add new procs.
    Aaron
    Please ratre helpful posts..

  • Grant execute to all custom stored procedures, not quite working

    I would like to grant execute permissions on all custom stored procedures to a group and have tried using this:
    USE myDB
    select 'GRANT EXECUTE ON ['+name+'] TO [mydomain\mydb] '  from sys.objects  where type ='P' and is_ms_shipped = 0
    It seems to execute without error, I see the full list of stored procedures I've created listed like this:
    GRANT EXECUTE ON [procUserInsert] TO [mydomain\mydb]
    However the stored procedure I added earlier, which didn't have any explicit rights set for it, does not show that the execute permission has been granted. Other stored procedures, where I had already granted execute to the group, remain as they were (which
    is expected). I'm viewing permissions via ssms, selecting the new stored procedure, then properties, permissions. If the grant failed there ought to be an error message...I don't get it. This is sql server 2005.

    It seems like you were only printing the statement (SELECT), but it is unclear if you executed them.
    You could try granting EXECUTE permission at either the DB scope or SCHEMA scope. That would grant EXECUTE on all modules (i.e. SPs, UDFs, etc.) at the chosen scope, including modules created in the future. For example:
    -- Grant EXECUTE permission on all DB
    GRANT EXECUTE TO [myDomain\mydbGroup1]
    go
    -- Grant EXECUTE permission on schema mySchema
    GRANT EXECUTE ON SCHEMA::[mySchema] TO [myDomain\mydbGroup2]
    go
    I hope this helps.
    BTW. The way you were creating the dynamic SQL for granting permissions to SPs individually is subject to 2<sup>nd</sup> order injection attacks. You should use quotename(name) in order to escape object names.
    -Raul Garcia
     SQL Server Security
    This posting is provided "AS IS" with no warranties, and confers no rights.

  • MultiSelect Parameter with Stored Procedure not working

    I am using Crystal Reports 2008 and SQL Server 2008. I am using a stored procedure which works with a multiselect in SQL side. I am using a string to table utility function in the where clause with the In statment like below:
    WHERE FORMULARY_ID in
    --(@FORMULARY_ID)
      (SELECT Extractedtext
       FROM ClarityTST.[rpt].[LHfn_StringToTable]( @FORMULARY_ID, ',') ) 
    When I try to use the stored procedure I get an error message:
    "The stored procedure cannot accept multiple values. Please ensure that the multiple value is set to False:"
    I would like to use it with multiple parameters.

    Crystal uses arrays to handle multiple values.  As far as I'm aware, there is no way to get a multi-valued report parameter into SQL (command or SP) directly.  In the past, I have used a "shell" main report that gets the parameters, used Join() to concatenate the selected values into a single string, then pass that to the "main" subreport, and into its SQL or SP.  The SQL than would need to find the database field in the string.  If you make the string passed to the subreport valid SQL for an IN clause, you could do it that way, too.
    HTH,
    Carl

  • Oracle Stored Procedure Not Accepting Comma delimited values in database

    I have a stored procedure which does the following, declares variables and assigns values retrieved from a parameter temp_table database to each variable, then it reads column headings from a master table. Using the variables assigned to each parameter from the temp_table as a filter, the rows from the MASTER TABLE are finally output by the procedure. The stored procedure works fine when dealing with single value string values passed from the parameter temp_table.
    The problem comes in when multiple values are selected and stored in the database parameter field as a comma separated string, eg. A045, A012
    So, the strored procedure has been modified to use a function to split the string into separate values: 'A045' and 'A012'. So that: A045, A012 from the database will be returned to the stored procedure variable as *('A045', 'A012')* . When testing the stored procedure using the static values *('A045', 'A012')* , data is returned.
    eg. EMPLOYEE_MASTER.CODE IN ('*A045*', '*A012*') will return results
    However, when *('A045', 'A012')* is dynamically concatenated from the function and assigned to variable:
    paramCode := split_str(paramCode) with paramCode eventually being passed: *('A045', 'A012')*
    to become:
    EMPLOYEE_MASTER.CODE IN (paramCode)
    then NO DATA is returned.
    I am stuck and don't know what the problem is. If anyone has any ideas, please feel free to help. I have included the Actual Stored Procedure below for a better understanding.
    --------------------------------------------- STORED PROCEDURE-------------------------------------------------------
    create or replace
    PROCEDURE GETEMPLOYEEDATA
    ( sesId IN VARCHAR2,
    l_cursor in out sys_refcursor
    ) is
    compCode varchar(200);
    businessUnit varchar(200);
    locCode varchar(200);
    hrDeptID varchar(200);
    glDept varchar(200);     plat varchar(200);
    deptFunc varchar(200);     empType varchar(200);
    unionCode varchar(200);     jobCode varchar(200);     
    careerLvl varchar(200);     
    empStatus varchar(200);
    zid varchar(200);
    superID varchar(200);
    counter varchar(200) ;
    token_index number;
    --v_errm VARCHAR2(256);
    BEGIN
    dbms_output.put_line('Start of BEGIN');
    /* Counter to get number of Unique Employee ID based on valid Session ID */
    select count(*) into counter from XXCCHRWEB.hr_web_sessionid_tmp where parameter_20=sesId;
    open l_cursor for SELECT counter EMPLOYEE_ID, '' LAST_NAME,
    '' FIRST_NAME from dual;
    dbms_output.put_line('OPENING FIRST CURSOR');
    /* If no valid session ID returned then error gently */
    if counter=0 then
    open l_cursor for SELECT '' EMPLOYEE_ID, '' LAST_NAME,
    '' FIRST_NAME,'' MIDDLE_NAME,'' NAME,
    '' EMPLOYEE_TYPE, '' COMPANY, '' COMPANY_DESCRIPTION,
    '' BUSINESS_UNIT, '' BUSINESS_UNIT_DESCRIPTION, '' LOCATION,
    '' LOCATION_NAME, '' HR_DEPARTMENT_ID,'' DEPARTMENT_NAME,
    '' DEPARTMENT_FUNCTION, '' PLATFORM, '' JOB_CODE,
    '' JOB_TITLE, '' BUSINESS_TITLE, '' MANAGER_LEVEL,
    '' JOB_FUNCTION, '' GL_DEPARTMENT_ID, '' GL_OP_UNIT,
    '' GL_RESPONSIBILITY_CENTER, '' HR_CHANNEL,'' FULL_OR_PART_TIME,
    '' REGULAR_OR_TEMP, '' GRADE,'' UNION_CODE,
    '' BARGAINING_UNIT, '' ANNUAL_RATE,'' HOURLY_RATE,
    '' HIRE_DATE, '' BIRTH_DATE, '' REHIRE_DATE,
    '' SERVICE_DATE, '' POSITION_NUMBER, '' REPORTS_TO,
    '' REPORTS_TO_TITLE, '' SUPERVISOR_ID, '' SUPERVISOR_NAME,
    '' LAN_ID from dual;
    dbms_output.put_line('End of counter=0');
    -- return;
    end if;
    /* read from hr_web_sessionid_tmp */
    select
    parameter_1,parameter_2, parameter_3, parameter_4,
    parameter_5,parameter_6, parameter_7, parameter_8,
    parameter_9,parameter_10, parameter_11, parameter_12,
    parameter_13, parameter_14
    into
    compCode,     businessUnit,     locCode, hrDeptID,
    glDept,     plat,     deptFunc,     empType,
    unionCode, jobCode,     careerLvl, empStatus,
    zid, superID
    from
    XXCCHRWEB.hr_web_sessionid_tmp
    where
    parameter_20= sesId;
    /*Assigning All Value to NULL superID*/
    IF superid is null then
    superID:= 'All';
    END IF;
    jobCode:='('''|| get_token(jobCode, 1)||''')'||','||'('''|| get_token(jobCode, 2)||''')';
    dbms_output.put_line('SELECTING PARAMETERS FROM TEMP TABLE WITH ROW COUNT : '||l_cursor%ROWCOUNT);
    /* read from Employee Master */
    open l_cursor for SELECT DISTINCT * FROM ( SELECT HR_EMPLOYEE_MASTER.EMPLOYEE_ID, HR_EMPLOYEE_MASTER.LAST_NAME,
    HR_EMPLOYEE_MASTER.FIRST_NAME, HR_EMPLOYEE_MASTER.MIDDLE_NAME, HR_EMPLOYEE_MASTER.NAME,
    HR_EMPLOYEE_MASTER.EMPLOYEE_TYPE, HR_EMPLOYEE_MASTER.COMPANY, HR_EMPLOYEE_MASTER.COMPANY_DESCRIPTION,
    HR_EMPLOYEE_MASTER.BUSINESS_UNIT, HR_EMPLOYEE_MASTER.BUSINESS_UNIT_DESCRIPTION, HR_EMPLOYEE_MASTER.LOCATION,
    HR_EMPLOYEE_MASTER.LOCATION_NAME, HR_EMPLOYEE_MASTER.HR_DEPARTMENT_ID, HR_EMPLOYEE_MASTER.DEPARTMENT_NAME,
    HR_EMPLOYEE_MASTER.DEPARTMENT_FUNCTION, HR_EMPLOYEE_MASTER.PLATFORM, HR_EMPLOYEE_MASTER.JOB_CODE,
    HR_EMPLOYEE_MASTER.JOB_TITLE, HR_EMPLOYEE_MASTER.BUSINESS_TITLE, HR_EMPLOYEE_MASTER.MANAGER_LEVEL,
    HR_EMPLOYEE_MASTER.JOB_FUNCTION, HR_EMPLOYEE_MASTER.GL_DEPARTMENT_ID, HR_EMPLOYEE_MASTER.GL_OP_UNIT,
    HR_EMPLOYEE_MASTER.GL_RESPONSIBILITY_CENTER, HR_EMPLOYEE_MASTER.HR_CHANNEL, HR_EMPLOYEE_MASTER.FULL_OR_PART_TIME,
    HR_EMPLOYEE_MASTER.REGULAR_OR_TEMP, HR_EMPLOYEE_MASTER.GRADE, HR_EMPLOYEE_MASTER.UNION_CODE,
    HR_EMPLOYEE_MASTER.BARGAINING_UNIT, HR_EMPLOYEE_MASTER.ANNUAL_RATE, HR_EMPLOYEE_MASTER.HOURLY_RATE,
    HR_EMPLOYEE_MASTER.HIRE_DATE, HR_EMPLOYEE_MASTER .BIRTH_DATE, HR_EMPLOYEE_MASTER.REHIRE_DATE,
    HR_EMPLOYEE_MASTER.SERVICE_DATE, HR_EMPLOYEE_MASTER.POSITION_NUMBER, HR_EMPLOYEE_MASTER.REPORTS_TO,
    HR_EMPLOYEE_MASTER.REPORTS_TO_TITLE, HR_EMPLOYEE_MASTER.SUPERVISOR_ID, HR_EMPLOYEE_MASTER.SUPERVISOR_NAME, HR_EMPLOYEE_MASTER.GENDER,
    HR_EMPLOYEE_MASTER_1.LAN_ID
    FROM
    (XXCCHR.HR_EMPLOYEE_MASTER HR_EMPLOYEE_MASTER_1
    LEFT OUTER JOIN
    XXCCHR.HR_DEPARTMENT_SECURITY HR_DEPARTMENT_SECURITY
    ON
    HR_EMPLOYEE_MASTER_1.EMPLOYEE_ID=HR_DEPARTMENT_SECURITY.EMPLOYEE_ID)
    LEFT OUTER JOIN
    XXCCHR.HR_EMPLOYEE_MASTER HR_EMPLOYEE_MASTER
    ON
    -- HR_DEPARTMENT_SECURITY.DEPARTMENT_SECURITY=HR_EMPLOYEE_MASTER.HR_DEPARTMENT_ID
    (HR_DEPARTMENT_SECURITY.DEPARTMENT_SECURITY=HR_EMPLOYEE_MASTER.HR_DEPARTMENT_ID
    or
    HR_DEPARTMENT_SECURITY.DEPARTMENT_SECURITY in ('DPALL','DPCAG009'))
    WHERE
    HR_EMPLOYEE_MASTER_1.LAN_ID=upper(zid) and
    (compCode = 'All' or HR_EMPLOYEE_MASTER.COMPANY IN compCode)
    (jobCode = 'All' or HR_EMPLOYEE_MASTER.JOB_CODE IN (jobCode) ) ) ;
    dbms_output.put_line('END OF SELECT for counter number : ' || counter ||' Cursor row count : '|| l_cursor%ROWCOUNT || ' with Job Code : ' || (jobCode));
    dbms_output.put_line('Company Code is:' || compCode);
    COMMIT;
    dbms_output.put_line('Data has been Output with session id:' || sesId);
    --delete from XXCCHRWEB.hr_web_sessionid_tmp where parameter_20= sesId;
    dbms_output.put_line('Data should have been DELETED, please check the session temp table');
    commit;
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line('AN EXCEPTION HAS BEEN CAUGHT for counter number : ' || counter ||' Cursor row count : '|| l_cursor%ROWCOUNT || ' from session id : ' || sesId);
    dbms_output.put_line('The error code is ' || SQLERRM);
    END GETEMPLOYEEDATA;
    Edited by: user10384134 on Nov 4, 2009 8:37 AM

    This seems to work for me:
    define param="'ABC','XYZ'"; --- Set up a test in clause
    --- Test data
    with test as
    (select 'ABC' fld from dual union all
    select 'DEF' from dual union all
    select 'PQR' from dual union all
    select 'XYZ' from dual)
    --- Query starts here.
    select fld
    from test,
           table (sys.ODCIVarchar2List (&param)) p
    where fld = p.column_valueOr Using an actual "IN" clause:
    define param="'ABC','XYZ'";
    with test as
    (select 'ABC' fld from dual union all
    select 'DEF' from dual union all
    select 'PQR' from dual union all
    select 'XYZ' from dual
    p as
    (select column_value from table (sys.ODCIVarchar2List (&param))
    select fld
    from test
    where fld in (select column_value from p)Edited by: AlanWms on Nov 4, 2009 9:08 AM

  • Java stored procedure not working

    I have done the following:
    loadjava -user lodonnel/lodonnel@albacore:1521:DEVAN -thin -force -resolver "((* lodonnell) (* public) (* -))" -v c:/usr/lod/java/dev/dbDir/displayStringsDB.jar
    Then:
    CREATE OR REPLACE FUNCTION LODONNEL.getSellingTitleDefinition( sellingID
    NUMBER, week VARCHAR2, netID NUMBER, moduleID NUMBER)
    RETURN VARCHAR2 AS LANGUAGE JAVA NAME
    'com.msa.gabriel.share.displaystrings.util.DatabaseAccess.getSellingTitleDefinition( int, java.lang.String, int, int ) return java.lang.String';
    Variable myString VARCHAR2;
    Call getSellingTitleDefinition( 3247, '02-11-2002', 2, 2) INTO :myString;
    I receive the following error:
    Message 1: ORA-29532: Java call terminated by uncaught Java exception: java.lang.VerifyError: Error detected by bytecode verifier when class was created
    Executing Command:
    Call getSellingTitleDefinition( 3247, '02-11-2002', 2, 2) INTO :myString
    Can someone help me determine where to look for this problem?
    The java classes being loaded do contain references to classes that I have not included in the jar, but from what I read the loadjava command I made should allow this. The code that would run in the procedure will not call any of the referenced classes that are not loaded here.

    I cut out all the functionality, and these are the two classes I am trying to load and run:
    package com.bob.gabriel.share.displaystrings.util;
    import java.sql.SQLException;
    import java.util.HashMap;
    import com.bob.media.displaystrings.util.DisplayStrings;
    public class DatabaseAccess {
    public static String getSellingTitleDefinition( int sellingID,
                                  String week, int
                                  netID, int
                                  moduleID ) throws
         SQLException {
         HashMap databaseArgs = new HashMap();
         databaseArgs.put( "ID", new Integer( sellingID) );
         databaseArgs.put( "WEEK", week );
         HashMap formatterArgs = new HashMap();
         formatterArgs.put( "NETWORKID", new Integer( netID ));
         formatterArgs.put( "MODULEID", new Integer( moduleID ));
         return DisplayStrings.getDisplayString();
    package com.bob.media.displaystrings.util;
    import java.util.Collection;
    import java.util.HashMap;
    import java.sql.SQLException;
    public class DisplayStrings {
    public static String getDisplayString() throws SQLException {
         return "woohoo!";
    * This static method is used as the common interface to return the specified formatted string.
    * @return formatted String to display on a UI
    * @param String - some kind of indicator of class that knows how to retrieve data?
    * @param HashMap - map of args needed to get the requested data.
    * @return formatted String to display on a UI
    * @param HashMap - map of args needed to get the format
    * information of the requested data.
    public static String getDisplayString( String type, HashMap databaseArgs, HashMap formatterArgs ) throws SQLException {
         try
    //      System.out.println( "in getDisplayString" );
    //      DisplayStringsDAO dao = getDAO( type );
    //      System.out.println( "got dao: " + dao );
    //      List data = dao.getUnparsedData( databaseArgs );
    //      System.out.println( "got List of data:" + data );
    //      Formatter formatter = getFormatter( type );
    //      System.out.println( "got formatter" );
    //      formatter.initialize( formatterArgs );
    //      System.out.println( "initialized formatter" );
    //      return formatter.format( data );
         return "got here am ok";
         catch ( Exception e )
         throw new SQLException ( "could not format requested string. " +
                   e.getMessage() );
    I build a jar file for them called displayStrings.jar
    I use the following load command:
    loadjava -user lodonnel/lodonnel@albacore:1521:DEVAN -thin -force -resolver "((* lodonnell) (* public) (* -))" -grant public -v c:/usr/lod/java/dev/dbDir/displayStringsDB.jar
    and the following create function command:
    CREATE OR REPLACE FUNCTION LODONNEL.getSellingTitleDefinition( sellingID
    NUMBER, week VARCHAR2, netID NUMBER, moduleID NUMBER) RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'com.bob.gabriel.share.displaystrings.util.DatabaseAccess.getSellingTitleDefinition( int, java.lang.String, int, int ) return java.lang.String';
    When I try this in SQLPlus:
    call getSellingTitleDefinition( 3247, '02-11-2002', 2, 2) into :theString;
    I get this:
    call getSellingTitleDefinition( 3247, '02-11-2002', 2, 2) into :theString
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception:
    java.lang.VerifyError: Error detected by bytecode verifier when class was
    created
    Classes were compiled and jar build using jdk1.3.1 and using ant.

  • Stored procedure not working (warning only my second written)

    I am now trying to get my 2nd SP to work. Any help with the problem I'm having would be greatly appreciated. This is not a complicated SP but I am creating dynamic sql. when running in TOAD as a straight SQL I was getting problems with the Execute immediate so I compiled as a SP to see if it resovled. Receiving the following error message:
    ORA-00936: missing expression
    ORA-06512: at "INSPQA.ODS_MODIFER_EXTRACT", line 32
    ORA-06512: at line 2
    Process exited.
    and here is the code
    PROCEDURE ods_modifer_extract AS
         TABLENAME VARCHAR2(100);
         TABLEXREF VARCHAR2(100);
         PERCENT VARCHAR2(3);
         VALUE VARCHAR2(100);
         DESCRIPTION VARCHAR2(100);
         sql_stmt VARCHAR2(1000);
         final_sql_stmt VARCHAR2(1000);
         CURSOR t1 IS
         SELECT XREFTABLE, TABLENAME, PERCENTAGE FROM ODS_MODIFIER_CONTROL;
    BEGIN
    FOR table_rec IN t1 LOOP
    TABLENAME := table_rec.TABLENAME;
         TABLEXREF := table_rec.XREFTABLE;
         VALUE := TABLENAME||'.'||TABLENAME||'ID';
         DESCRIPTION := TABLENAME||'.DESCRIPTION';
         PERCENT := table_rec.PERCENTAGE;
         sql_stmt := 'SELECT '||VALUE||' AS VALUE, '||DESCRIPTION||' AS DESCRIPTION, ';
         sql_stmt := sql_stmt||''''||TABLENAME||''' AS SOURCETABLE, ';
         sql_stmt := sql_stmt||''''||TABLENAME||'ID'' AS SOURCECOLUMN, ';
         IF PERCENT = '100' THEN
              sql_stmt :=sql_stmt||PERCENT||' AS PERCENTAGE ,';
              ELSE
              sql_stmt := sql_stmt||TABLEXREF||'.PERCENTAGE AS PERCENTAGE ,';
              END IF;
         sql_stmt := sql_stmt||' ODS_INSPECTION_EXTRACT.INSPECTIONEVENTID, ODS_INSPECTION_EXTRACT.OCCURRENCEDATE ';
         sql_stmt := sql_stmt||'FROM ODS_INSPECTION_EXTRACT, '||TABLEXREF||', '||TABLENAME;
         sql_stmt := sql_stmt||' WHERE ODS_INSPECTION_EXTRACT.ROOFFEATURESID = '||TABLEXREF||'.ROOFFEATURESID AND ';
         sql_stmt := sql_stmt||TABLEXREF||'.'||TABLENAME||'ID = '||TABLENAME||'.'||TABLENAME||'ID';
         final_sql_stmt := 'INSERT INTO ODS_MODIFIER_EXTRACT VALUES ('||sql_stmt||')';
         EXECUTE IMMEDIATE final_sql_stmt;
    END LOOP;
    END;

    final_sql_stmt := 'INSERT INTO ODS_MODIFIER_EXTRACT
    CT VALUES ('||sql_stmt||')';
         EXECUTE IMMEDIATE final_sql_stmt;
    END LOOP;
    END;Take the VALUES word out of the final_sql_stmt. Should work.

  • Stored Procedure requires compilation before every run....

    I have one simple SP in Oracle 8. It gets complied very nicely. But after i execute that SP, its defination from the database is lost. I again have to compile and execute it. This means that everytime i have to execute this SP i have first compile....
    I can't understand why this is happening??? IIf anybody knows how this can be solved then plz let me know...

    following is the SP code. Its long but a simple SP. I am not modifying any underlying objects. I think even if they are modified the SP gets recompiled when called... Have a look at it and help me...
    procedure apptrack_ware_funding_retrieve
    al_seller_id IN NUMBER,
    al_julian_id_num IN NUMBER,
    as_pgm_type_cde_uw_out OUT VARCHAR2,
    as_trust_acct_ind_out OUT VARCHAR2,
    af_tran_amt_sum_out OUT NUMBER,
    as_updt_dt_tm OUT VARCHAR2,
    al_traunch_use_out OUT NUMBER,
    al_whse_line_lmt_out OUT NUMBER,
    as_rpt_end_dt_out OUT VARCHAR2,
    al_pay_down_amt_out OUT NUMBER,
    al_tot_trust_acct_adva_out OUT NUMBER, /* Date:07/21/2000 .Added By Sunil */
    al_tot_trust_acct_reversal_out OUT NUMBER, /* Date:07/21/2000 .Added By Sunil */
    al_trust_reversal_amt_out OUT NUMBER
    AS
    sql_err NUMBER;
    err_msg VARCHAR2(300);
    li_row_count NUMBER;
    BEGIN
    select count(1) into li_row_count
    from TRUST_ACCT_ACTIVITY
    where SEQ_NUM = (select max(SEQ_NUM) from TRUST_ACCT_ACTIVITY
    where SELLER_ID = al_seller_id and
    JULIAN_ID_NUM = al_julian_id_num) and TRAN_CDE = 'R';
    if li_row_count = 1 then
    select TRAN_AMT into al_trust_reversal_amt_out
    from TRUST_ACCT_ACTIVITY
    where SEQ_NUM = (select max(SEQ_NUM) from TRUST_ACCT_ACTIVITY
    where SELLER_ID = al_seller_id and
    JULIAN_ID_NUM = al_julian_id_num) and TRAN_CDE = 'R';
    else
    al_trust_reversal_amt_out := 0;
    end if;
    /* Anthony Start 07/06/2000.*/
    select count(1) into li_row_count
    from seller_pay_down
    where (seller_id = al_seller_id and
    julian_id_num = al_julian_id_num );
    if li_row_count > 0 then
    select sum(pay_down_amt) into al_pay_down_amt_out
    from seller_pay_down
    where (seller_id = al_seller_id and julian_id_num = al_julian_id_num);
    else
    al_pay_down_amt_out := 0;
    end if;
    /* Anthony End. 07/06/2000.*/
    /* Dhawal changes begin. 06/22/2000.*/
    select count(1) into li_row_count
    from seller
    where seller_id = al_seller_id;
    if li_row_count = 1 then
    select to_char(max(rpt_end_dt),'MM/DD/YYYY') into as_rpt_end_dt_out
    from seller_settlement_summary
    where seller_id = al_seller_id;
    end if;
    /* Dhawal changes end. 06/22/2000.*/
    select count(1)
    into li_row_count
    from seller_traunch
    where seller_id = al_seller_id;
    if li_row_count > 0 then
    select sum(traunch_use_lmt) into al_traunch_use_out from seller_traunch
    where seller_id = al_seller_id and
    traunch_type||eff_dt in (select traunch_type||max(eff_dt)
    from (select * from seller_traunch where seller_id = al_seller_id)
    group by traunch_type);
    end if;
    select count(1)
    into li_row_count
    from seller
    where seller_id = al_seller_id;
    if li_row_count > 0 then
    select whse_line_lmt
    into al_whse_line_lmt_out
    from seller
    where seller_id = al_seller_id;
    end if;
    select count(1) into li_row_count
    from underwriting_info
    where (julian_id_num = al_julian_id_num
    and loan_type = '08'
    and preflite_ind ='P');
    if li_row_count = 1 then
    select pgm_type_cde_uw into
    as_pgm_type_cde_uw_out
    from underwriting_info
    where (julian_id_num = al_julian_id_num
    and loan_type = '08'
    and preflite_ind ='P');
    end if;
    select count(1) into li_row_count
    from seller
    where seller_id = al_seller_id;
    if li_row_count = 1 then
    select trust_acct_ind into
    as_trust_acct_ind_out
    from seller
    where seller_id = al_seller_id;
    end if;
    select nvl(sum(tran_amt),0) into
    af_tran_amt_sum_out
    from trust_acct_activity
    where seller_id = al_seller_id;
    /* Date:07/21/2000 .Added By Sunil to calculate total of all trust account advances for seller id */
    select nvl(sum(tran_amt),0) into
    al_tot_trust_acct_adva_out
    from trust_acct_activity
    where seller_id =al_seller_id
    and julian_id_num = al_julian_id_num
    and tran_cde = 'F' ;
    /* End of Adddition -------- Sunil. */
    /* Date:07/21/2000 .Added By Sunil to calculate total of all trust account reversals for seller id */
    select nvl(sum(tran_amt),0) into
    al_tot_trust_acct_reversal_out
    from trust_acct_activity
    where seller_id =al_seller_id
    and julian_id_num = al_julian_id_num
    and tran_cde = 'R';
    /* End of Adddition -------- Sunil. */
    select count(1) into li_row_count
    from trust_acct_activity
    where seller_id = al_seller_id
    and julian_id_num = al_julian_id_num
    and tran_cde = 'F'
    and seq_num = (select max(seq_num) from trust_acct_activity
    where seller_id = al_seller_id
    and julian_id_num = al_julian_id_num
    and tran_cde = 'F');
    if li_row_count = 1 then
    select to_char(updt_dt_tm,'MM/DD/YYYY HH24:MI:SS') into as_updt_dt_tm
    from trust_acct_activity
    where seller_id = al_seller_id
    and julian_id_num = al_julian_id_num
    and tran_cde = 'F'
    and seq_num = (select max(seq_num) from trust_acct_activity
    where seller_id = al_seller_id
    and julian_id_num = al_julian_id_num
    and tran_cde = 'F');
    end if;
    dbms_output.put_line ('program Type Code UW = ' || as_pgm_type_cde_uw_out);
    dbms_output.put_line ('Trust Account Indicator = ' || as_trust_acct_ind_out);
    dbms_output.put_line ('Trust Account Current Balance = ' || af_tran_amt_sum_out);
    dbms_output.put_line ('Report End Date = ' || as_rpt_end_dt_out);
    EXCEPTION
    when others then
    sql_err := sqlcode;
    err_msg := sqlerrm;
    DBMS_OUTPUT.PUT_LINE (sql_err);
    DBMS_OUTPUT.PUT_line (err_msg);
    APPTRACK_UPDATE_ERRLOG('OTHERS', SQLCODE, SQLERRM, 'apptrack_ware_funding_retrieve', 'JULIAN_ID_NUM='||TO_CHAR(NVL(al_julian_id_num, 0)));
    raise_application_error(-20011,'Database Error - Database Error code = '||sql_err||', Database Error Text = '||err_msg);
    END apptrack_ware_funding_retrieve;

Maybe you are looking for

  • Can I transfer my Iphone info to my new computer?

    Hi folks! Recently i bought Windows 7 for my laptop and i completely forgot to do a back up of my itunes library, so i have nothing in there right now. I still have everything in my iphone but i would like to know if i can transfer all my info from t

  • Arch Still Dead, can't get it to work!!!

    K.  So I updated my kernel and forgot to run Lilo. When I boot from the FTP/base CD, I type: arch root=/dev/discs/disc0/part3 But then I cannot run lilo!!  It can't find it!  And the root is the CD, not my drive. WHAT DO I DO?!?!  THIS IS DRIVING ME

  • Mountain Lion mirroring - screen resolution problems

    I've just upgraded to Mountain Lion and am no longer able to set the screen resolutions on the iMac monitor and my Sony LCD 46" to mirror properly. Previously it worked very well by selecting the highest resolution for both the iMac and the TV - but

  • Scroll bars on a tab canvas

    Hi when I run my forms the scroll bar on the tab canvas is disabled. How can enable it?

  • Airport Express 6.2 not working with PPPoE

    This is strange. I've got an ADSL connection and I can get it working perfectly happily directly connected to an iBook, a Mac mini and even a Dos machine (running XP). However I get a 'connection refused' in the log of the Airport Express. I've got i