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?

Similar Messages

  • Connect the schema via oracle 10g stored procedures

    Hi,
    How to connect the another schema through the oracle stored procedures?.I have the 3 in parameters like username,password,hoststring
    and i have admin password also.For example i have logged to the admin user and i need to execute the procedures with 3 in parameters.i want to connect the another schema through the stored procedures with crenditials(3 in parameters).The stored procedures has been created in admin user.
    Please give me your ideas ASAP.
    Thanks&Regards
    N.Sivaraman

    Create procedure create_db_link (user, paswword, host) as
    begin
    execute immediate' CREATE DATABASE LINK TEST CONNECT TO  || user || ' IDENTIFIED BY  || paswword || '  USING ''' || host || ''';
    end;
    Create procedure drop_db_link as
    begin
    execute immediate' DROP DATABASE LINK TEST';
    end;
    Create procedure main as
    begin
    create_db_link;
    select whateever into v_whatever from TableA@test;
    drop_db_link;
    end;

  • How to connect to UNIX OS from oracle stored procedure

    Hi,
    I need to connect to UNIX OS from oracle stored procedure.
    Curently working in Oracle9i.
    I tried in google but I could'nt get any.
    Can you send me pointers on how to do this.
    Thanks,
    Kavitha.

    Can use Java Stored Proc, or an External Proc.
    Java method:
    create or replace and compile Java Source named "OSCommand" as
    -- java:        OS COMMAND
    -- descr:       Executes an Operating System Command using the JAVA RTS
    -- IN parameter:        os command to execute (including fully qualified path names)
    -- OUT parameter:       returncode [\nstring]
    --                      where string a max of 32000 chars of the output of the command
    --                      (note that \n is used as separators in the string)
    --                      returncode=-1   Java RTS error occurred (e.g. command does not exist)
    --                      returncode=255  o/s command failed (e.g. invalid command params)
    import java.io.*;
    import java.lang.*;
    public class OSCommand{
            public static String Run(String Command){
                    Runtime rt = Runtime.getRuntime();
                    int     rc = -1;
                    try{
                            Process p = rt.exec( Command );
                            int bufSize = 32000;
                            int len = 0;
                            byte buffer[] = new byte[bufSize];
                            String s = null;
                            BufferedInputStream bis = new BufferedInputStream( p.getInputStream(), bufSize );
                            len = bis.read( buffer, 0, bufSize );
                            rc = p.waitFor();
                            if ( len != -1 ){
                                    s = new String( buffer, 0, len );
                                    return( s );
                            return( rc+"" );
                    catch (Exception e){
                            e.printStackTrace();
                            return(  "-1\ncommand[" + Command + "]\n" + e.getMessage() );
    show errors
    create or replace function osexec( cCommand IN string ) return varchar2 is
    -- function:    OS EXEC
    -- descr:       Executes an Operating System Command
    language        JAVA
    name            'OSCommand.Run(java.lang.String) return java.lang.String';
    show errors===
    This can then be used from PL/SQL and even SQL. e.g.
    SQL> select osexec( '/bin/date' ) from dual;
    OSEXEC('/BIN/DATE')
    Wed Nov  9 13:30:13 SAST 2005
    SQL>Note the Java permissions required - replace FOO with the name of applicable Oracle schema
    ==begin
            dbms_java.grant_permission(
                    'FOO',
                    'SYS:java.io.FilePermission',
                    '<<ALL FILES>>',
                    'execute'
            dbms_java.grant_permission(
                    'FOO',
                    'SYS:java.lang.RuntimePermission',
                    'writeFileDescriptor',
            dbms_java.grant_permission(
                    'FOO',
                    'SYS:java.lang.RuntimePermission',
                    'readFileDescriptor',
            commit;
    end;
    /==
    Last thing... note that opens a potential giant size security hole into the Oracle Server Platform. So implement it properly using a proper Oracle security model.

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

  • Need Help in with Querying Stored Procedures from UCCX Database

    Hi All
    We are trying to build a custom reporting solution using a BI tool and for which we have provided the ODBC connectivity to the UCCX database to our SQL server.
    We have installed the ODBC drivers on our SQL server and made a connection to UCCX version 10.0 successfully. we are using the username 'uccxhruser' to connect to the DSN.
    We want to query the stored procedure sp_csq_activity from the Microsoft SQL Server Management Studio. When we add the Linked Server in the SQL Server, we are able to see the Data Tables and also query them using the select statement. However, we are not able to see any of the Stored procedures within the Linked Server Tab.
    Can someone guide us in the right direction as to how to go about the process. Is calling the stored proedure the right way or we need to query the individual tables as mentioned in the Database Schema Guide and then once the historical tables our there in our server , then build the report.
    Any help will be much appreciated.
    Regards
    Abhinav

    Hi,
    what happens if you try to execute the above SP? They should be accessible AFAIK.
    G.

  • Cursor with nested query in stored procedure problem

    Hello
    I'm trying to declare the folowing (example) cursor in a stored procedure in Oracle 8i:
    CURSOR RECORDS IS SELECT d.DUMMY, (SELECT dd.DUMMY FROM dual dd) FROM dual d;
    The nested part "(SELECT d.DUMMY FROM dual)" is not alowed, while the same query runs outside the stored procedure. Can someone explain why this is not alowed and how to solve the problem whitout rewriting the query?
    Tom

    When i run the same code in SQL plus:
    SQL> declare
    2 CURSOR RECORDS IS SELECT d.DUMMY, (SELECT dd.DUMMY FROM dual dd) FROM dual d;
    3 begin
    4 null;
    5 end;
    6 /
    CURSOR RECORDS IS SELECT d.DUMMY, (SELECT dd.DUMMY FROM dual dd) FROM dual d;
    FOUT in regel 2:
    .ORA-06550: line 2, column 36:
    PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
    ( - + mod not null others <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql stddev sum variance
    execute forall time timestamp interval date
    <a string literal with character set specification>
    <a number> <a single-quoted SQL string>
    ORA-06550: line 2, column 66:
    PLS-00103: Encountered the symbol "FROM" when expecting one of the following:
    ; return returning and or
    Different versions of Oracle?

  • Specific query, stored procedure

    Post Author: Alfonso Calderon
    CA Forum: .NET
    Hello, good day.
    I am new in crystal report for vs 2003, I have several querys to get some information comming from an access aplication now migrated to vb 2003, so in access I can make reports from views and querys, does anyone knows how can I do this in Crystal?
    How can I create a report from an stored procedure?
    Thanks and best regards.
    AC

    Post Author: MJ@BOBJ
    CA Forum: .NET
    The first question isn't easy to answer without knowing how you've designed your report.  Generally, there are 2 models for a datasource for a report, Pull Model, and Push Model.  Pull Model is where you connect directly to a database and add tables/stored procs/views to a report and the when you preview the report it connects to the datasource and returns data.  The Push Model is where you design a report against an ADO.NET DataSet schema (.xsd) and at runtime push a populated DataSet/DataTable object to the report.  So the design of your report will dictate how you populate the report from your stored proc.
    Again, there is lots of info on the BOBJ devlibrary that shows you your databaes connectivity options and samples on how to get render your report with data from your stored proc.  You may need to read through some of the content before you get what you're looking for.  The same goes for setting values for your parameters, it's all in the online help.
    You can also download samples applications that show you your database options (push vs pull) and setting parameter values.  Search for CR .NET Samples from the BOBJ support site and you can download a package of samples you can look at.
    -MJ

  • How do i fire a query/Stored procedure only once

    Hi,
    I have a master frame and multiple child frames. Master frame triggers child1 frame which triggers child 2 frame etc using some common keys between the frame.
    Now each frame executes a stored procedure and then uses the Db2 cursor as a record set. However when the same frame is fired again then the stored procedure is triggered again. But i could very well use the same record set from the record set that i already have,
    In other words i need to fire the stored procedure/query only once and not every time the frame is fired.
    I just need to get the record set for each frame and then operate on the retrieved record sets.
    Is there a way to do this?
    Currently I experience serious performance issues as the stored procedures get fired repeatedly thousands of times
    Any help will be greatly appreciated
    Thanks
    anand

    I am still haveing problems so I will try and attach my program and see if you can help a little more that. It will probably be easier for you to look at this way. When you look at the diagram sequence 0 is the one the problem is in. In that sequence you will see a case structure and that is where the finite pulse train vi is. When case 1 is selected the finite pulse train will run again and again until I leave case 1. I need to have the program run the finite pulse train once and then wait and do nothing until the case is changed. The finite pulse train will be in all cases inside the case structure I just haven't done that yet, I am waiting until it works. The pulse train is used to move a stepper motor that is why running only once is im
    portant because the stepper motor is used to position something.
    Attachments:
    AMC_Eagle_Both_Inputs_Working_2.vi ‏266 KB

  • Very Urgent!! Stored Procedure Problem!!!

    Hi Friends,
    I am in a great trouble!! I hv a procedure which has a print statement in it. Is it possible to capture or redirect the output of my print message???
    Say, my procedure is like
    create procedure MyProc as
    select * from table1
    print "Hello World!!"
    goWhen I run my JDBC query thru CallableStatement my result set holds only the value of select query, but what my "Hello World!!" ??????
    Thanks.
    Kesavan.

    Hi Kesavan,
    PRINT is just an SQL*PLus command. If you want to capture your output you'll have to assign it to an OUT parameter in your stored procedure then return is that OUT parameter to your callableStatement.
    Richard

  • Oracle9iAS MapViewer - Stored Procedure problem

    Can anyone help - I would like to use stored procedures within MapViewer <jdbc_query> element to define themes dynamically. My attempts thus far have been unsuccessful, for example:
    <themes>
    <theme name="theme1">
    <jdbc_query
    spatial_column="lon_lat_hgt"
    render_style="MDSYS:C.RED"
    jdbc_host="my_host"
    jdbc_port="1521"
    jdbc_sid="csd"
    jdbc_srid="8307"
    jdbc_mode="thin"
    jdbc_user="scott"
    jdbc_password="tiger">select adwg_l16_utils_map.ADWG_L16_UTILS.J35_GET_AOI(swLon,swLat,neLon,neLat) from j35</jdbc_query>
    </theme>
    </themes>
    (the above attempt was created along the lines of 'select sysdate from dual')
    Is this approach valid (if so could someone provide an example), or will I have to construct a 'standard' select query.
    Thanks in advance.

    Chris,
    It should be possible, provided that:
    1. your stored procedure returns objs of type sdo_geometry.
    2. you use a column alias so that it is the same as the value of your "spatial_column" attribute.
    3. if you do not specify the "asis" attribute in the jdbc_query element, then you must have a spatial index on the geometry column; in your case you may want to creat a function-based spatial index on your procedure. Please refer to the Spatial user's guide for how to achieve that.
    thanks,
    lj

  • Oracle Stored Procedure problem

    I am upgrading to Coldfusion 8 from MX. I currently have a
    program that accesses Oracle 10g using a stored procedure call
    (cfstoredproc). It works on MX but not on 8. I can do regular
    queries to the Oracle database successfully. Here is the error
    mesage I'm receiving:
    Error Executing Database Query.
    [Macromedia][Oracle JDBC Driver][Oracle]ORA-06550: line 1,
    column 18: PLS-00222: no function with name 'EVENT_COUNT' exists in
    this scope ORA-06550: line 1, column 7: PL/SQL: Statement ignored
    Any ideas?

    Perhaps this tech note may point to one possible solution.
    Updated
    DataDirect JDBC drivers (version 3.5)
    The following problems are corrected in this release of the
    DataDirect drivers.
    Oracle
    61145 - Oracle 10g R2 not supported. cfstoredproc calls that
    return result sets hang the server with both the 3.3, 3.4 and 3.5
    drivers until this version. The 3.5 build 13 drivers support Oracle
    10g R2.
    Phil

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

  • 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

  • Collable statement and stored procedure problem

    Hi,
    I am using a collable statement to execute a stored procedure.
    The stored procedure is a bit complex since it uses a function to retrieve sequence nextval (newId),
    than insert a row and returns the newId.
    Anyway, I checked it with sql plus and it works, but when trying to execute it from my Java code, I get the following error message:
    java.sql.SQLException: ORA-06550: line 1, column 33:
    PLS-00103: Encountered the symbol ";" when expecting one of the following:
    . ( ) , * @ % & | = - + < / > at in mod not range rem => ..
    <an exponent (**)> <> or != or ~= >= <= <> and or like
    between is null is not || indicator is dangling
    The symbol ")" was substituted for ";" to continue.
    Anyone can help?
    Thanks,
    Michal

    My PL/SQL code:
    CREATE OR REPLACE FUNCTION getNotifSeq RETURN NUMBER
    IS
    newId NUMBER;
    BEGIN
         SELECT NOTIFICATION_SEQ.NEXTVAL INTO newId FROM DUAL;
    RETURN newId;
    END;
    run
    CREATE OR REPLACE PROCEDURE insertNotifMsg (
    sentBy IN VARCHAR,
    subject IN VARCHAR,
    msg IN VARCHAR,
    newId OUT NUMBER)
    IS
    BEGIN
    newId := getNotifSeq;
    INSERT INTO NOTIFICATIONS(NOTIF_ID,SENT_BY,SUBJECT,MSG)
    VALUES(newId,sentBy,subject,msg);
    END insertNotifMsg;
    run;
    My Java code to call the procedure:
    try
    conn = myDBconn.getConnection();
    CallableStatement callStmt = conn.prepareCall("{call insertNotifMsg(?,?,?,?}");
    callStmt.setString(1,notif.getSentBy());
    callStmt.setString(2,notif.getSubject());
    callStmt.setString(3,notif.getMsg());
    callStmt.registerOutParameter(4, Types.INTEGER);
    ResultSet rs = callStmt.executeQuery();
    if (!rs.next()) {
    throw new SQLException("ERROR: Notification was not inserted into database!");
    long newId = callStmt.getInt(4);
    callStmt.close();
    notif.setNotifId(newId);
    conn.commit();
    callStmt.close();
    finally
    myDBconn.closeConnection(conn);
    Thanks,
    Michal

Maybe you are looking for