Procedure within procedure problem

Hi
I have a table of 5 different magazines and a table of purchases of those magazines. I have written a procedure to take the details of a given magazine and place the sales for a given month into a sales table as follows:
create or replace procedure monthly_sales(mag number, startdate date, enddate date) is
magtotal number(7,0);
magprice magazine.unitprice%type;
magsales number(7,2);
begin
select count(p.magid), m.unitprice into magtotal, magprice from purchase p, magazine m where p.datepurchased between startdate and enddate and p.magid = mag and m.magid=p.magid
group by m.unitprice;
magsales := magtotal*magprice;
insert into sales values(startdate, mag, magtotal, magsales);
end;
What I would like to do though is have a procedure that you just need to run once and it will enter the sales for a given month for all magazines into the sales table. My thought was to try to do this using procedures within a procedure as follows:
create or replace procedure monthly_sales(startdate date, enddate date) is
magtotal number(7,0);
magprice magazine.unitprice%type;
magsales number(7,2);
procedure mag1 is
begin
select count(p.magid), m.unitprice into magtotal, magprice from purchase p, magazine m where p.datepurchased between startdate and enddate and p.magid = 1 and m.magid=p.magid
group by m.unitprice;
magsales := magtotal*magprice;
insert into sales values(startdate, 1, magtotal, magsales);
end mag1;
procedure mag2 is
begin
select count(p.magid), m.unitprice into magtotal, magprice from purchase p, magazine m where p.datepurchased between startdate and enddate and p.magid = 2 and m.magid=p.magid
group by m.unitprice;
magsales := magtotal*magprice;
insert into sales values(startdate, 2, magtotal, magsales);
end mag2;
procedure mag3 is
begin
select count(p.magid), m.unitprice into magtotal, magprice from purchase p, magazine m where p.datepurchased between startdate and enddate and p.magid = 3 and m.magid=p.magid
group by m.unitprice;
magsales := magtotal*magprice;
insert into sales values(startdate, 3, magtotal, magsales);
end mag3;
procedure mag4 is
begin
select count(p.magid), m.unitprice into magtotal, magprice from purchase p, magazine m where p.datepurchased between startdate and enddate and p.magid = 4 and m.magid=p.magid
group by m.unitprice;
magsales := magtotal*magprice;
insert into sales values(startdate, 4, magtotal, magsales);
end mag4;
begin
select count(p.magid), m.unitprice into magtotal, magprice from purchase p, magazine m where p.datepurchased between startdate and enddate and p.magid = 5 and m.magid=p.magid
group by m.unitprice;
magsales := magtotal*magprice;
insert into sales values(startdate, 5, magtotal, magsales);
end;
However, when I run this it is ignoring all the procedures within the main procedure and just entering the results for magazine 5. I'm at a loss as to why this isn't working, is this even the correct way to go about it? any help would be greatly appreciated
thanks

Why doing it the hard way?
A single insert statement will do the trick.
I made a bit of a guess as to the structure of your tables:
create table magazine (magid number primary key, unitprice number);
create table purchase (magid number references magazine(magid), datepurchased date);
create table sales (startdate date, magid number references magazine(magid), magtotal number, magsales number);
insert into magazine(magid, unitprice) values (1, 3.95);
insert into magazine(magid, unitprice) values (2, 4.95);
insert into magazine(magid, unitprice) values (3, 3.50);
insert into magazine(magid, unitprice) values (4, 6.0);
insert into magazine(magid, unitprice) values (5, 5.50);
insert into purchase(magid, datepurchased) values (1, sysdate);
insert into purchase(magid, datepurchased) values (1, sysdate);
insert into purchase(magid, datepurchased) values (2, sysdate);
insert into purchase(magid, datepurchased) values (2, sysdate);
insert into purchase(magid, datepurchased) values (2, sysdate);
insert into purchase(magid, datepurchased) values (4, sysdate);
insert into purchase(magid, datepurchased) values (5, sysdate);
insert into purchase(magid, datepurchased) values (5, sysdate);
insert into purchase(magid, datepurchased) values (5, sysdate);
insert into purchase(magid, datepurchased) values (5, sysdate);
commit;
create or replace procedure monthly_sales(p_startdate in date, p_enddate in date)
is
begin
  insert into sales (startdate, magid, magtotal, magsales)
    select p_startdate
    ,      p.magid
    ,      count(p.magid)
    ,      count(p.magid) * m.unitprice
    from   purchase p
      join magazine m on m.magid = p.magid
    where  p.datepurchased between p_startdate and p_enddate
    group by p.magid
    ,        m.unitprice;
end;
begin
  monthly_sales(trunc(sysdate,'MM'), last_day(trunc(sysdate,'MM')));
end;
select * from sales;
STARTDATE      MAGID   MAGTOTAL   MAGSALES
01-JAN-11          1          2        7.9
01-JAN-11          2          3      14.85
01-JAN-11          4          1          6
01-JAN-11          5          4         22

Similar Messages

  • Re   Java Stored Procedure Problem

    Ben
    There appear to be some problem with the forum. It doesn't want to show my response to your post with the subject "Java Stored Procedure Problem". See the answer to this thread for an example of how to do this...
    Is there a SAX parser with PL/SQL??

    Ben
    There appear to be some problem with the forum. It doesn't want to show my response to your post with the subject "Java Stored Procedure Problem". See the answer to this thread for an example of how to do this...
    Is there a SAX parser with PL/SQL??

  • In completion procedure Problem

    i am using one incompletion procedure for two sales documnet types Ex: X & Y both are working for different sales organizations
    1)When ia m doing Sales order with X document it is not getting the partner "sales tax form type" while saving
    2) in Y sales document type it is getting the partner " Sales tax form type "  while saving
    can any one guide how to over come this
    Kishore

    Hi ,
              This does not sound like an Incompletion procedure problem. They might have used an user exit(Userexit_save_document_ prepare) to populate this partner function when the sales org is "Y". Kindly please check with the help of abap'er If you can not.
    Regards
    Ram Pedarla

  • Calling Stored Procedure problem

    Hi there,
    I got a little problem with a BizTalk solutions I am building with an Oracle DB (9i) as backend:
    I need to call a stored procedure which will export the data I need to get to an export-table. The call for the sp works fine but after the call succeeded I get empty results from within the export_table. If I use SQL developer a few seconds / mins later I get the results I wanted.
    So first question: If I call a sp without return params, is it possible that the .Net code just waits if the SP could successfully be called and then works on, or does it wait until the SP successfully finished it´s work and then works on?
    Second question: If it only waits until the SP could successfully be called, is there a way to wait until the SP has finished without changing the SP?
    Thanks for your help.
    René

    Hi,
    Calling a stored procedure is not asynchronous - that is, the stored procedure completes execution before control is returned to your application.
    If, for example, you have a multi-threaded application and call the stored procedure in a worker thread the primary thread may continue executing, but I'm not sure that is what you are doing.
    - Mark

  • ODI send Email procedure Problem

    Hi ,
    I am trying to send email using ODI
    I have found in oracle support that if we configure TRT_Send_Jython_HTML_Email.xml procedure we can send an email
    I tried doing so, but even though I select the LoadFromFile as no , I am getting the following error
    org.apache.bsf.BSFException: exception from Jython:
    Traceback (innermost last):
    File "<string>", line 1, in ?
    File "C:\Oracle\product\11.1.1\Oracle_ODI_1\oracledi\client\odi\bin\..\..\jdev\extensions\oracle.odi.navigator\scripting\Lib\smtplib.py", line 483, in sendmail
    File "C:\Oracle\product\11.1.1\Oracle_ODI_1\oracledi\client\odi\bin\..\..\jdev\extensions\oracle.odi.navigator\scripting\Lib\smtplib.py", line 352, in rset
    File "C:\Oracle\product\11.1.1\Oracle_ODI_1\oracledi\client\odi\bin\..\..\jdev\extensions\oracle.odi.navigator\scripting\Lib\smtplib.py", line 294, in docmd
    File "C:\Oracle\product\11.1.1\Oracle_ODI_1\oracledi\client\odi\bin\..\..\jdev\extensions\oracle.odi.navigator\scripting\Lib\smtplib.py", line 271, in getreply
    SMTPServerDisconnected: Connection unexpectedly closed
    at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
    at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.execInBSFEngine(SnpScriptingInterpretor.java:345)
    at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.exec(SnpScriptingInterpretor.java:169)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java:2374)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java:1615)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java:1580)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java:2755)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2515)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:534)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:449)
    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1954)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:322)
    at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:224)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:246)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:237)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:794)
    at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:114)
    at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
    at java.lang.Thread.run(Thread.java:619
    Can anyone pls tell me how to resolve this problem.
    Thanks
    Ashvini

    Are you sure that you can reach the smtp server from within your network ? You would want to verify that first following this -http://support.microsoft.com/kb/153119

  • JTA (EJB-- Store Procedure) Problem

    I'm currently facing a problem that I'm not sure how to fix it.
              I have a Controller class that is accessing many EJB (Session Stateless Container Managed) that are a kind of Store Procedures' Wrappers.
              The Controller initializes the transaction using the UserTransaction and it commits or rollback as needed, also de EJBs at some points use the setRollbackOnly() and also inside the store procedures are some explicit commits.
              What should I expect in the following scenario:
              UserTransaction ut=null;
              try {
              ut = getUserTransaction();
              ut.begin();
              ejb1.update(); //Calls a store procedure that in the pl/sql calls commit
              ejb2.delete(); //Inside the Ejb some component throws an exception and is catched by the Ejb, then it calls setRollbackOnly() and throws a new Exception
              ut.commit();//This is not called because the previous exception
              } catch(Exception e){
              ut.rollback();//Rollback is called
              1) Is the modified data inside ejb1.update saved?
              2) Is this all wrong?
              3) What could it be a right approach to refactor this?
              Thanks,
              Johann

    johann renck wrote:
              > There is one store proc who cares about logging that is called by many others sp that
              > is the one who does commit and also is wrapped by an Ejb so it is also called inside
              > the application. Have this sp its own transaction context so when it does commit it
              > just commits the logging?
              >
              > Thanks,
              > Johann
              Yes, always. Any procedure that calls begin tran, commit, rollback, or any other call that
              changes the transactional behavior of the session, must be isolated from everything that
              WebLogic thinks is part of a transaction. Otherwise you're just going to jeopardize the
              integrity of your WebLogic-defined transactions. Ideally, you want all your transactions
              defined and controlled at one level. From the EJB/WebLogic point of view it would be much
              safer and superior to never call any procedure that had such stuff, and then do logging
              as it's own WLS EBJ tx, called everywhere needed, from within but separate from larger EJB
              transactions. Even if a logging EJB did nothing besides writing one log row, the procedure
              shouldn't call commit. The EJB system will do that.
              Note well: Anything that calls that logging procedure with the commit, commits it's
              current possibly partial transaction to that point. The DBMS connection only has one
              transaction going on at a time, and a commit permanently locks in everything changed since
              the last commit. It is not good architecture to have commits in any utility procedure.
              At the very least, if your procedures want a transaction, they should start and end
              in one procedure, eg:
              BEGIN
                   declare boolean variable in_tx
              set in_tx true if @@trancount > 0
                   if (not in_tx) BEGIN TRAN -- Otherwise, just become part of current tx
                   ... do work... this is only needed for multi-update work
              if (not in_tx) COMMIT TRAN
              END
              If the procedure only does one update/insert/delete *you don't need any
              tx control*! eg:
              BEGIN
                   insert into mylogtable values (.....)
              END
              That one insert will be part of any ongoing tx if extant, or
              will be it's own one auto-commit tx.
              If you have a procedure that must be it's own tx, then you must
              do:
              BEGIN
                   if (@@trancount > 0) raiserror("Can't call this procedure from an ongoing transaction. It must be able to commit immediately")
              END

  • Creating pl/sql procedure problems

    Dear all,
    I have problems with creating a procedure which select returns more then one row.
    CREATE OR REPLACE PROCEDURE ECM_DATA.check_padrones_datos
    IS
      v_padron_check   VARCHAR2(50);
      v_padron_number   VARCHAR2(50);
    BEGIN
       SELECT count(pd.estado)
       INTO v_padron_check
       FROM par6.padrones_datos pd, par6.padrones p, par6.FECHAS f
         where pd.estado not in ('2000','8000')
         AND PD.ARCHIVO = P.ARCHIVO
         AND P.FECHA = F.datum_s;
        DBMS_OUTPUT.PUT_LINE('Št. neuspešnih zapisov :  ' || v_padron_check);
        SELECT distinct pd.archivo
       INTO v_padron_number
       FROM par6.padrones_datos pd, par6.padrones p, par6.FECHAS f
         where pd.estado not in ('2000','8000')
         AND PD.ARCHIVO = P.ARCHIVO
         AND P.FECHA = F.datum_s;
        DBMS_OUTPUT.PUT_LINE('Padron št. :  ' || v_padron_number);
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
         v_padron_number := 'Vsi padroni so OK';
         DBMS_OUTPUT.PUT_LINE('Padron št. :  ' || v_padron_number);
    END;
    Error ->  -01422: exact fetch returns more than requested number of rows
    Select returns 2 or more rows.
    SELECT distinct pd.archivo
        FROM par6.padrones_datos pd, par6.padrones p, par6.FECHAS f
         where pd.estado not in ('2000','8000')
         AND PD.ARCHIVO = P.ARCHIVO
         AND P.FECHA = F.datum_s;
    How to write correct syntax in pl/sql. I apologize in advance for rookie questions. Any help would be appreciated.
    Regards,
    Robert

    The exact implementation depends on the use case.
    You can loop through the results
    FOR r IN (
        SELECT  DISTINCT pd.archivo
        FROM    par6.padrones_datos pd
               ,par6.padrones p
               ,par6.fechas f
        WHERE   pd.estado not in ('2000','8000')
        AND     pd.archivo = p.archivo
        AND     p.fecha = F.datum_s
    LOOP
        dbms_output.put_line('Padron št. :  ' || r.archivo);
    END LOOP;
    Or maybe you can process all results in one step, e.g. if you want to update a table based on the select.
    Regards
    Marcus

  • PR release procedure problem

    We are using SAP 4.7 EE Version.
    Regarding PR release procedure, I have created PR release procedure by using characteristics with Plant, Total value of the item, document type, creation indicator and account assignment category.
    Created class PR_RELEASE with above-mentioned characteristics. The same is used in PR release procedure.
    When I am creating PR, the release procedure not picking up for standard procurement (stock material) account assignment category.
    We have identified the problem with account assignment category u2018 u2018 (Standard) while creating PR. For other account assignment categories (K, U, X, A), it is working fine.
    Recommend any SAP note numbers if you have or known.
    Points will be rewarded.
    Thanks,
    SK
    Edited by: s k on Jun 9, 2008 2:11 PM
    Edited by: s k on Jun 9, 2008 2:12 PM

    Hi
    Blank Account assignment does not work, as you cannot create a chracteristic Value as Blank.
    You need to create a new release strategy without the account assignment category chracter.
    Or remove the account assignment Chracterisitc from the release strategy
    Thanks & Regards
    Kishore

  • Release procedure problem and error

    Dear Friends ,
    I facing some major problems in release procedure , i had configured one release procedure in 4levels , due to some reason i had deleted 3release groups and codes due to it was not working . But after deleteing  in purchase order it showing all release level and only firest level is working unable to make MIGO and other release levels are not working  . The relese code which i had created is appearing in RFQ/CONTRACT etc automatically . I had not created for this any release level . It's very very different case ....till date never faced and heared . How to resolve this probelm . Due to what reasons this kind of problems occurs .
    RB

    Hi,
    Try  to delete all the release procedure available in the system.
    First  try to do the documents coorectly and configure.
    You might have done mistake in assigning the charcteristics to the class
    Please try create a NEw release procedure once again.
    Don't worry about the procedure in the RFQetc...
    G.Ganesh Kumar

  • Pricing Procedure problem when creating order w/Ref to billing doc

    Hello all.
    When I create a SO w/ SaType 'A' it picks the correct Pricing procedure. However if I were to create the same Order Type 'A' w/ reference to a billing doc it picks up the Pricing procedure of the billing doc and not the one assigned to it in PP determination.
    Also this works correctly when I create SO w/ref to billing doc with order type 'B'. So I am kinda stumped as to why it would not work with the order type in the above example.

    Hi Robert,
    Check the copy control configuration:
    Spro>Sales and Distribution>Sales-->Maintain Copy Control for Sales Documents
    In this, select
    Copying Control: Billing Document to Sales Document
    on the pop-up.
    In the next screen, select the appropriate source billing doc type to target Sales Order type that gives you problem.  Then in its details, select Item and then the item category that is being defaulted into your SO#, in its copy function, verify the Pricing Type.  It can be made to the same value as the one that works fine for you (the other document types config).
    regards

  • PROCEDURE PROBLEM - Exact Fetch Returns More Than Requested Number of Rows

    Here is my procedure:
    CREATE OR REPLACE PROCEDURE question4
      ( cust_first IN customer.custfirstname%TYPE,
       cust_last IN customer.custlastname%TYPE,
       customer_no OUT customer.customerSsn%TYPE,
       cust_address OUT customer.address%TYPE,
       loanID OUT loan.loanNo%TYPE,
       application_date OUT loan.appdate%TYPE,
       remaining_payments OUT loan.remainingpaymentsdue%TYPE,
       loan_amount OUT loan.loanamount%TYPE,
       loan_term OUT loan.loanterm%TYPE,
       interest_rate OUT loan.interestrate%TYPE,
       monthly_payment OUT loan.monthlypayment%TYPE)
       AS
    BEGIN
      SELECT customerssn, address  INTO customer_no, cust_address FROM CUSTOMER WHERE custfirstname= cust_first AND custlastname = cust_last;
      SELECT loanno, remainingpaymentsdue, loanamount, loanterm, interestrate, monthlypayment, appdate INTO loanID, remaining_payments, loan_amount, loan_term, interest_rate, monthly_payment, application_date FROM LOAN WHERE customerSsn = customer_no;
      EXCEPTION
        WHEN OTHERS
        THEN
        NULL;
    END;Here is the anonymous block showing the use of my procedure.
    SET SERVEROUTPUT ON
    DECLARE
      customer_number customer.customerSsn%TYPE := NULL;
      customer_address customer.address%TYPE := NULL;
      loan_number loan.loanNo%TYPE := NULL;
      app_date loan.appdate%TYPE := NULL;
      rem_payment loan.remainingpaymentsdue%TYPE := NULL;
      l_amount loan.loanamount%TYPE := NULL;
      l_term loan.loanterm%TYPE := NULL;
      i_rate loan.interestrate%TYPE := NULL;
      m_payment loan.monthlypayment%TYPE := NULL;
      view_customerSSN NUMBER;
      view_address VARCHAR2(50);
      view_loanID NUMBER;
      view_date DATE;
      view_remaining_payment NUMBER;
      view_loan_amount NUMBER(8,2);
      view_loan_term VARCHAR2(10);
      view_interest_rate FLOAT(20);
      view_monthly_payment NUMBER(8,2);
    BEGIN
      question4 ('Tim', 'Thompson',  customer_number, customer_address, loan_number, app_date, rem_payment, l_amount, l_term, i_rate, m_payment);
      IF (customer_number IS NULL OR customer_address IS NULL OR loan_number IS NULL OR app_date IS NULL
      OR rem_payment IS NULL OR l_amount IS NULL OR l_term IS NULL OR i_rate IS NULL OR m_payment IS NULL) THEN
         DBMS_OUTPUT.PUT_LINE ('NULL VALUE');
      ELSE
        view_customerSSN := customer_number;
        view_address := customer_address;
        view_loanID := loan_number;
        view_date := app_date;
        view_remaining_payment := rem_payment;
        view_loan_amount := l_amount;
        view_loan_term := l_term;
        view_interest_rate := i_rate;
        view_monthly_payment := m_payment;
        DBMS_OUTPUT.PUT_LINE ('CUSTOMER NO : ' ||  view_customerSSN);
        DBMS_OUTPUT.PUT_LINE ('CUSTOMER ADDRESS : ' ||  view_address);
        DBMS_OUTPUT.PUT_LINE ('LOAN NO : ' ||  view_loanID);
        DBMS_OUTPUT.PUT_LINE ('LOAN APPLICATION DATE : ' ||  view_date);
        DBMS_OUTPUT.PUT_LINE ('REMAINING PAYMENTS : ' ||  view_remaining_payment);
        DBMS_OUTPUT.PUT_LINE ('LOAN AMOUNT : ' ||  view_loan_amount);
        DBMS_OUTPUT.PUT_LINE ('LOAN TERM : ' ||  view_loan_term);
        DBMS_OUTPUT.PUT_LINE ('INTEREST RATE : ' ||  view_interest_rate);
        DBMS_OUTPUT.PUT_LINE ('MONTHLY PAYMENT : ' ||  view_monthly_payment);
      END IF;
    END;
    /Error Message:
    Error report:
    ORA-06550: line 21, column 3:
    PLS-00306: wrong number or types of arguments in call to 'QUESTION4'
    ORA-06550: line 21, column 3:
    PL/SQL: Statement ignored
    *06550. 00000 - "line %s, column %s:\n%s"*
    **Cause: Usually a PL/SQL compilation error.*
    **Action:*
    What is the problem here? Could you anyone help me?
    Thanks for your help from now on.
    Have a beautiful day...
    Edited by: RobertPires on May 1, 2011 5:13 PM
    Edited by: RobertPires on May 1, 2011 8:19 PM

    Thanks for your help, Sir. As you see it as above, I fixed the order of parameters, but since I would like to display multiple records, my procedure did not work properly and I got this error message:
    Error report:
    ORA-01422: exact fetch returns more than requested number of rows
    ORA-06512: at "S4048958.QUESTION4", line 20
    ORA-06512: at line 21
    *01422. 00000 - "exact fetch returns more than requested number of rows"*
    **Cause: The number specified in exact fetch is less than the rows returned.*
    **Action: Rewrite the query or change number of rows requested*
    I guess I need to create a cursor in my procedure, but I dunno how. Could you give me some suggestion for this please?
    Thanks again...

  • To connect a datablock to a query - stored procedure: problem

    I have the following table...
    CREATE TABLE I_TIPOLOGIA (
    CODICE NUMBER(6),
    DESCRIZIONE VARCHAR2(100),
    CONSTRAINT I_TIPOLOGIA_PK PRIMARY KEY (CODICE) );
    and the following package to connect a datablock to
    previous table with a stored procedure...
    CREATE or REPLACE PACKAGE DATABANKER_TIPOLOGIE AS
    TYPE TipTableOfRec IS TABLE OF I_TIPOLOGIA%ROWTYPE;
    PROCEDURE leggi(resultset IN OUT TipTableOfRec);
    END DATABANKER_TIPOLOGIE;
    CREATE or REPLACE PACKAGE BODY DATABANKER_TIPOLOGIE AS
    PROCEDURE leggi(resultset IN OUT TipTableOfRec) AS
    BEGIN
    SELECT * BULK COLLECT INTO resultset
    FROM I_TIPOLOGIA;
    END leggi;
    END DATABANKER_TIPOLOGIE;
    When I compile the form I receive in QUERY-PROCEDURE trigger
    en error 306: "number or type of arguments are wrong in POPULATE_BLOCK"
    I post the trigger auto generated by Forms Builder 6i...
    DECLARE
    bk_data DATABANKER_TIPOLOGIE.TIPTABLEOFREC;
    BEGIN
    DATABANKER_TIPOLOGIE.leggi3(bk_data);
    PLSQL_TABLE.POPULATE_BLOCK(bk_data, 'BLOCCO50'); -- <- error here
    END;
    How can I solve this problem? Maybe there is a bug?
    P.S. I'm using Oracle Database 9i

    CREATE or REPLACE PACKAGE DATABANKER_TIPOLOGIE AS
    TYPE TipTableOfRec IS TABLE OF I_TIPOLOGIA%ROWTYPE;
    PROCEDURE leggi(resultset IN OUT TipTableOfRec);
    END DATABANKER_TIPOLOGIE;I have solved with this replacement 1) -> 2)
    1) TYPE TipTableOfRec IS TABLE OF I_TIPOLOGIA%ROWTYPE;
    2) TYPE TipTableOfRec IS TABLE OF I_TIPOLOGIA%ROWTYPE
    INDEX BY BINARY_INTEGER;
    with 2) now works.
    Now I have stored-procedures for query, insert, delete
    and update.
    I have some problems with delete and update of the records
    because it seems that they are locked.
    I think that it is due to the absence of lock
    stored-procedure... there's someone that can help me with
    the lock SP implementation?

  • DBMS_JOB on Java Stored Procedure problem

    Hi all,
    (running on Oracle 9i : 9.2.0.7.0 64bit on HP/UX)
    I have a Java Stored procedure that reads a table
    One of the fields in this table is a CLOB containing some more SQL.
    We then executeQuery() that SQL (and e-mail the output).
    (Obviously I also have PL/SQL wrapper around it, which we'll call PROCNAME).
    For certain pieces of SQL, this second executeQuery() fails throwing ORA-00942, but only when run from a DBMS_JOB(!).
    Calling "CALL PROCNAME('argument')" from sqlplus/toad works fine, but setting "PROCNAME('argument')" to run as a DBMS Job fails on some SQL with the above error. (All as the same username).
    java.lang.StackTraceElement doesn't seem to exist in Oracle java, so the only error I have to go on is e.getMessage() from SQLExecption which returns:
    ORA-00942: table or view does not exist
    Any help at this strangeness would be appreciated!
    nic

    Hi Cris:
    May be is a problem of the effective user which is running the procedure.
    Which is the auth_id directive at the PLSQL call spec?
    Look at this example procedure UploadNews for example:
    http://dbprism.cvs.sourceforge.net/dbprism/cms-2.1/db/cmsPlSqlCode.sql?revision=1.21&view=markup
    this procedure calls to the cmsNews.doImport which is implemented as Java Stored Procedure.
    Also check if your loadjava operation is not using -definer flag.
    Best regards, Marcelo.

  • Java Stored Procedure Problem

    Hi all,
    I was able to deploy the Java class into the database (the message says Success). And then I am able to desc MyJavaSproc name in SQL*Plus and see the Pl/SQL parameter and return types. But when I use either call or select from dual, it tells me the the Java class (MyJavaName) is not there. The Oracle error is this: ORA-29540: class MyJavaName does not exist. I am running 10gR2. I did encounter a problem when I first tried to deploy using J2SE 1.5 as source and target and JDev suggested that I change that to an earlier version. I changed that to 1.4 and then deployed successfully.
    Could someone help me with this? Thanks a lot.
    Ben

    Thanks. I created a simple file Java class with JDev (10g 1.3). I have some static methods (according to Oracle docs) in the class. Then by following JDev's help doc, I created a deployment profile for the project using JDec. I then added the Java methods that I wanted to deploy as sprocs. As I said, after I changed the J2SE from 1.5 (the default) to 1.4, the deployment was successful. I can see it using desc in SQL*Plus. I can also see it in the database connection tab in JDev. I can open the class stub created by JDev, and the sprocs and funcs are listed under Functions and Procedures on the database connection tab.
    Thanks.
    Ben

  • Java stored procedure problem(oracle db)

    HI,
    we have a java stored procedure with the following definition, and that works as we want it to:
    CREATE OR REPLACE FUNCTION processBulletin(in_varchar VARCHAR2) RETURN VARCHAR2
    AS LANGUAGE JAVA
    NAME 'JavaParser.Bufr_Ingest.processBulletin(java.lang.String) return java.lang.String';
    And the Java portion:
    public static String processBulletin(String in_bull)
    ... do something with in_bull
    The problem is that we've recently discovered that the 32767 size restiriction on the input parameter varchar2 is too small. I don't want to rewrite the entire Java procedure. I figured the simplest (or at least temporary)solution would be to have the Java procedure accept a CLOB, convert that clob to a string and continue as it would. I was hoping someone might be able to tell me if the following would be possible:
    CREATE OR REPLACE FUNCTION processBulletin(in_clob CLOB) RETURN VARCHAR2
    AS LANGUAGE JAVA
    NAME 'JavaParser.Bufr_Ingest.processBulletin(oracle.sql.CLOB) return java.lang.String';
    And the Java portion:
    public static String processBulletin(oracle.sql.CLOB in_clob)
    String in_bull = clob_in.getSubString(1, (int)clob_in.length());
    ... do something with in_bull
    Thanks

    I don't know about Java stored procedures, but in JDBC you usually use streams to work with CLOBS. Here's Oracle JDBC Developers Guide, Working with LOBs

Maybe you are looking for

  • How can I remove albums from the "Music" icon on iPad2?

    When I select the "Music" icon on my iPad2, there are two albums I have placed there that I would like to remove.  How can I do that? Thanks for your help. Vernon

  • Customer Hierarchy not showing in sales document

    Hi All, I have used the standard hierarchy type (A) to create a 2(or 3) level hierarchy  (top level node, 2nd level node and sold t party) and the hierarchy assignments look fine at the customer level. I have assigned the hierarchy type to the sales

  • Technical Article on Service-oriented Integration Using JBI Posted

    I've just posted an article on the open-esb site about using JBI for what we have come to call service-oriented integration: enterprise integration atop a SOA fabric. The article includes an example of a simple adapter pattern implementation that inc

  • QuickTime error 2330

    just recently, I have tried to install iTunes. It gets about 85% complete, then throws a QuickTime error. The code is 2330 and after reading for a while the solution seems to be removing QuckTime from your system. Every time I try to do this, I get t

  • Using different content with template tag (struts)

    I developed a page according to the examples on the following link. http://jakarta.apache.org/struts/api/org/apache/struts/taglib/template/package-summary.html my problem is, that i want to use different pages as content. How can i do this?? do i nee