Probleme with stored procedure in oracle 10 g

I create a stored procedure for archiving successfully compile but when I select t_sql_statement i have 0 rows :( :(
create or replace
PROCEDURE p_archive_test(piv_owner varchar2)
is
lv_stmt varchar2(2000) := 'insert /*+ append */ into TABLE1 (COLUMNS)
                                                                 select INS_COLUMNS
                                                                 from TABLE2 tab2@db1
                                                                 where not exists (select null
                                                                                     from TABLE1 tab1
                                                                                     where PKCOLUMNS
cursor c_tab is
select tab.table_name,'ERR$_'||tab.table_name ERR_TABLE
from all_tables tab
          where tab.owner = piv_owner
-- and tab.table_name = 'action'
--order by atb.TABLE_ORDER
-- For each table get the primary key columns     
cursor c_pk(civ_table_name in all_tables.TABLE_NAME%type)
is
select acl.COLUMN_NAME
from all_cons_columns acl
,all_constraints acn
where acn.OWNER = piv_owner
and acn.CONSTRAINT_TYPE = 'P'
and acn.TABLE_NAME = civ_table_name
and acl.OWNER = acn.OWNER
and acl.TABLE_NAME = acn.table_name
and acl.CONSTRAINT_NAME = acn.CONSTRAINT_NAME
order by acl.POSITION;
-- For each table get the corresponding table columns names
cursor c_ins_cols(civ_table_name in all_tab_columns.TABLE_NAME%type)
is
select 'tab2.'||atc.COLUMN_NAME column_name
from all_tab_columns atc
where atc.OWNER = piv_owner
and atc.TABLE_NAME = civ_table_name
order by atc.COLUMN_ID;
-- For each table get the columns names excluding the primary key columns
cursor c_upd_cols(civ_table_name in all_tab_columns.TABLE_NAME%type)
is
select 'tab1.'||atc.COLUMN_NAME||'=tab2.'||atc.column_name column_name
from all_tab_columns atc
where atc.OWNER = piv_owner
and atc.TABLE_NAME = civ_table_name
and not exists (select 1
from all_cons_columns acl
,all_constraints acn
where acl.OWNER = atc.owner
and acl.TABLE_NAME = atc.TABLE_NAME
and acl.column_name = atc.column_name
and acn.OWNER = acl.OWNER
and acn.TABLE_NAME = acl.TABLE_NAME
and acn.constraint_type = 'P')
order by atc.COLUMN_ID;
-- For each table get the columns names
cursor c_cols(civ_table_name in all_tab_columns.COLUMN_NAME%type)
is
select
--'tab1.'||
atc.COLUMN_NAME column_name
from all_tab_columns atc
where atc.owner = piv_owner
and atc.TABLE_NAME = civ_table_name
order by atc.COLUMN_ID;
lv_cols varchar2(4000);
lv_pk_cols varchar2(4000);
lv_ins_cols varchar2(4000);
lv_upd_cols varchar2(4000);
BEGIN
for r_tab in c_tab
loop
lv_cols := '';
lv_pk_cols := '';
lv_ins_cols := '';
lv_upd_cols := '';
for r_pk in c_pk(civ_table_name => r_tab.table_name)
     loop
lv_pk_cols := lv_pk_cols||'tab1.'||r_pk.column_name||'=tab2.'||r_pk.column_name||' and ';
end loop r_pk_loop;
lv_pk_cols := substr(str1 => lv_pk_cols
,pos => 1
,len => length(ch => lv_pk_cols) - 5);
for r_ins_cols in c_ins_cols(civ_table_name => r_tab.table_name)
loop
lv_ins_cols := lv_ins_cols||r_ins_cols.column_name||',';
end loop r_ins_cols_loop;
lv_ins_cols := substr(str1 => lv_ins_cols
,pos => 1
,len => length(ch => lv_ins_cols) - 1);
for r_upd_cols in c_upd_cols(civ_table_name => r_tab.table_name)
     loop
lv_upd_cols := lv_upd_cols||r_upd_cols.column_name||',';
end loop r_upd_cols_loop;
lv_upd_cols := substr(str1 => lv_upd_cols
,pos => 1
,len => length(ch => lv_upd_cols) - 1);
for r_cols in c_cols(civ_table_name => r_tab.table_name)
     loop
lv_cols := lv_cols||r_cols.column_name||',';
end loop r_cols_loop;
lv_cols := substr(str1 => lv_cols
,pos => 1
,len => length(ch => lv_cols) - 1);
lv_stmt := replace(replace(replace(replace(replace(replace(replace(lv_stmt
,'TABLE1'
,r_tab.table_name)
,'TABLE2'
,'DIST_'||r_tab.table_name)
,'PKCOLUMNS'
,lv_pk_cols)
,'UPD_COLUMNS'
,lv_upd_cols)
,'INS_COLUMNS'
,lv_ins_cols)
,'COLUMNS'
,LV_COLS)
,'TABLE3'
,R_TAB.ERR_TABLE);
-- here It highy advisable to store the sql statement that will be submitted
-- to the SQL engine before executing it dynamically
insert into t_sql_statement values (lv_stmt);
execute immediate lv_stmt;
end loop ;
commit;
exception
when others then
rollback;
raise;
end p_archive_test;

Welcome to the forum!
Unfortunately you have posted to the wrong forum. This question is not about sql developer and is more appropriate for the sql and pl/sql forum
PL/SQL
Please
1. repost the question in the SQL and PL/SQL forum
2. edit this question to tell people to followup in the other forum - post the link to the question in the other forum
3. mark this question answered so people will followup in the other forum.
Read the FAQ in the other forum (there will be link at the top right of the page) for how to post a question and the information you need to provide. In particular use 'code' tags (see FAQ for explanation) before and after posted code and always provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION).
Before you post the new thread I suggest you perform some additional testing by
1. Modify your code so that it creates the statements but does not execute them. With dynamic sql the most common problem is incorrect syntax and until you have verified that the syntax is both correct and exactly what you want it is a waste of time to execute the statements.
2. Modify your code to only create one statement (add WHERE ROWNUM = 1 to the main query). If the syntax is wrong it will be wrong for all of the statements so until the code works correctly for one loop it is a waste of time perform 10's or 100' of loops.
3. Currently you are not committing the creation of the statement itself but only after it is executed. Thus if the execution fails the query that failed won't be available for you to examine. Either commit the INSERT or, at a minimum capture the query into a global variable and add a DBMS_OUTPUT to the exception handler to display the failed query so you can examine and test it to fix any problem.
Also, by just blindly using the data in ALL_TAB_COLS you are not taking into account that Oracle creates hidden (see the hidden column) and virtual columns that will cause your processing to fail for any tables that use them since you cannot use them directly in queries like you are creating.

Similar Messages

  • Problem With Stored Procedure

    Post Author: Ranjith.403
    CA Forum: General
    Hi,
    Am new to crystal reports with stored procedures
    am created a report using a stored procedure in oracle. In that Stored Procedure am Using a temporary table.
    After inserting values into the table am assigning to ref cursor.
    Refcursor having fields like item,onhandstock,purchase rate
    This report working fine in oracle version 9.2.0.1.0 where comes to oracle version 9.2.0.8.0 it's giving the varchar values correctly.
    The Number values are showing as 0.
    Help me to solve it.
    Thanks in Advance,
    Ranjith

    Try modularising this large procedure into smaller procedures and functions, and determine which part is causing you trouble.

  • Problem with stored procedure usage when Toplink api is used

    In one of our applications we used the combination of JBoss4.0.2 application server, Oracle Toplink 10g (9.0.4.5), JDBC Driver Version is ..... 10.1.0.2.0, Database Product Version is Oracle9i Enterprise Edition Release 9.2.0.6.0, j2sdk1.4.2_08
    We faced problem in the application when it is trying to call stored procedure using Oracle Toplink api
    code snippet:
    public ByteArrayOutputStream baos = new ByteArrayOutputStream();
    public PrintStream pos = new PrintStream(baos);
    public String delete(String Id)
    String procedureName = "abc";
    try
    UnitOfWork uow = PersistenceManager.getCurrent().getUnitOfWork();
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName(procedureName);
    call.addUnamedArgumentValue(Id);
    uow.executeNonSelectingCall(call);
    uow.commit();
    catch (Exception e)
    message = e;
    e.printStackTrace(pos);
    message = message+ baos.toString();
    return message;
    Stack Trace:
    Exception [TOPLINK-4002] (OracleAS TopLink - 10g (9.0.4.5) (Build 040930)): oracle.toplink.exceptions.DatabaseException Exception Description: java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00201: identifier 'abc' must be declared ORA-06550: line 1, column 7: PL/SQL: Statement ignored Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00201: identifier 'abc' must be declared ORA-06550: line 1, column 7: PL/SQL: Statement ignored Error Code: 6550Local Exception Stack: Exception [TOPLINK-4002] (OracleAS TopLink - 10g (9.0.4.5) (Build 040930)): oracle.toplink.exceptions.DatabaseException Exception Description: java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00201: identifier 'abc' must be declared ORA-06550: line 1, column 7: PL/SQL: Statement ignored Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00201: identifier 'DELETE_LOADED_RESULT_SET' must be declared ORA-06550: line 1, column 7: PL/SQL: Statement ignored Error Code: 6550 at oracle.toplink.exceptions.DatabaseException.sqlException(DatabaseException.java:227) at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:733) at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:781) at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:642) at oracle.toplink.publicinterface.UnitOfWork.executeCall(UnitOfWork.java:1400) at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(CallQueryMechanism.java:131) at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(CallQueryMechanism.java:115) at oracle.toplink.internal.queryframework.CallQueryMechanism.executeNoSelectCall(CallQueryMechanism.java:164) at oracle.toplink.internal.queryframework.CallQueryMechanism.executeNoSelect(CallQueryMechanism.java:143) at oracle.toplink.queryframework.DataModifyQuery.execute(DataModifyQuery.java:41) at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:493) at oracle.toplink.publicinterface.Session.internalExecuteQuery(Session.java:1958) at oracle.toplink.publicinterface.UnitOfWork.internalExecuteQuery(UnitOfWork.java:2236) at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1086) at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1038) at oracle.toplink.publicinterface.Session.executeNonSelectingCall(Session.java:816) at com.abc.de.fg.model.resultSet.ResultSetProvider.delete(ResultSetProvider.java:150) at
    Could anyone please let me know what might be the problem in this case.

    Tried and couldn't reproduce the problem using 9.0.4.7.
    Here's the code:
        System.out.println("storedProcedureUnamedValueTest");
        StoredProcedureCall call = new StoredProcedureCall();
        String lastName = "Jones";
        call.setProcedureName("STOREDPROCEDURE_IN");
        call.addUnamedArgumentValue(lastName);
        session.executeNonSelectingCall(call);stored procedure definition in data base:
    CREATE OR REPLACE  PROCEDURE "TEST_904"."STOREDPROCEDURE_IN"  (
         IN_PARAM VARCHAR2) AS
    BEGIN
      UPDATE EMPLOYEE SET F_NAME = 'Indiana' WHERE (L_NAME = IN_PARAM);
    END;log:
    storedProcedureUnamedValueTest
    DatabaseSession(15)--Execute query DataModifyQuery()
    DatabaseSession(15)--Connection(16)--BEGIN STOREDPROCEDURE_IN('Jones'); END;
    DatabaseSession(15)--Connection(16)--reconnecting to external connection poolAndrei

  • Problem with Stored Procedure exection in Sender and Receiver side of JDBC

    Hi All,
    I am facing problem while executing Stored Procedures using sender and receiver sides of JDBC adapter.
    Here is my SP in Oracle DB :
    PROCEDURE EMP                           
    ( ID IN VARCHAR2,NAME IN VARCHAR2,PROCESSED IN VARCHAR2  ) AS                                                          
    BEGIN                                                         
       INSERT INTO EMPLOYEE VALUES (ID, NAME, PROCESSED);COMMIT;END EMP;
    Now I want to execute this SP using sender JDBC channel and receiver JDBC channel.
    Can anyone please help me executing this SP?
    Regards,
    Soorya

    Hi Soorya,
    The receiver Data type should be like this:
    <StatementName>
    <storedProcedureName action=u201D EXECUTEu201D>
        <table>realStoredProcedureeName</table>
    <param1 [isInput=u201Dtrueu201D] [isOutput=true] type=SQLDatatype>val1</param1>
    </storedProcedureName >
      </StatementName>
    Check the link http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
    Which DB  are you using?? The sender structure will be like
    <resultset>
    <row>
    <field1></field1>
    <field2></field2>
    <field3></ field3>
    </row>
    </resultset>
    Search SDN you will get lot of examples
    Regards
    Suraj

  • Problem with stored procedure in DB2

    Hi,
    Rigth now im havin a little problem trying to CALL a DB2 SP
    I have a DB2 SP, something like this:
    CREATE PROCEDURE ordenes.XXMOR_GuardaEncabezado
    in p_ORDID     INTEGER,
    in p_ADVID     CHAR     (6),
    in p_ACCTHDRID     CHAR     (6),
    in p_STNID     CHAR     (6),
    in p_ORDTYP     SMALLINT,
    in p_STRDT     varchar(10),
    in p_EDT     char(10),
    in p_MCONTID     CHAR     (16),
    in p_AGYESTNUM     CHAR     (20),
    IN p_PRDID1 CHAR(4),
    in p_RTCRD     CHAR     (6),
    in p_USRFLD1     CHAR     (6),
    in p_USRFL10     SMALLINT,
    in p_TOTSPTORD     INTEGER,
    in p_CMT char(136),
    in p_ROTID CHAR(20),
    in p_Aux1 varchar(15),
    in p_Aux2 varchar(15),     
    in p_Aux3 varchar(15),      
    in p_Aux4 varchar(15),
    in p_Aux5 varchar(15),
    out o_ORDID varchar(15)
    And i calling the SP from my AppModuleImpl java class like this:
    getDBTransaction().createStatement(0).getConnection().prepareCall("CALL ordenes.XXMOR_Ords(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
    i am using this convention to pass the parameters:
    Integer = setInt
    Smallint = setShort
    Char and Varchar = setString
    and getString for the output:
    But i only recibe this exception everytime i try to run the SP: java.sql.SQLException: Parameter type not valid.
    Can anyone help me ! ?
    Ty, regards from Mexico.

    I am using Stored procedure and that is working fine in Oracle
    This is my XI Request structure :
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:read_PROC_GET_ACTIVE_ESIIDS xmlns:ns0="http://reliant.com/xi/BMFR2">
    - <statement>
    - <PROC_GET_ACTIVE_ESIIDS action="EXECUTE">
      <table>TCS.PKG_BMF_MANAGE_SERVICE_DATA.PROC_GET_ACTIVE_MF_ESIIDS</table>
      <in_bmf_partner_id isInput="true" type="VARCHAR">994</in_bmf_partner_id>
      <in_esids isInput="true" type="CLOB">1008901001155950587100:1008901001155950545100:1008901001155950671100:1008901001155950114100</in_esids>
      </PROC_GET_ACTIVE_ESIIDS>
      </statement>
      </ns0:read_PROC_GET_ACTIVE_ESIIDS>
    This is oracle Stored procedure signature :
    PROCEDURE PROC_GET_ACTIVE_ESIIDS
    in_bmf_partner_id           IN   kss_activity_stg_curr_stat.BMF_PARTNER_ID%TYPE,
    in_esids                    IN   CLOB,
    out_recordset               OUT  sys_refcursor
    Let me know if you need any further information.
    Thanks,
    Hetal

  • Problem with Stored Procedure and inout parameter and jdbc-odbc bridge

    create or replace procedure test_proc( para in out number) as
    begin
    if para = 1 then
    para := 11111;
    else
    para := 22222;
    end if;
    end;
    public static void main(String args[]) throws Exception{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String url = "jdbc:odbc:test3";
    String uid = "scott";
    String pwd = "tiger";
    Connection conn = DriverManager.getConnection(url,uid,pwd);
    CallableStatement cstmt = conn.prepareCall("{call test_proc(?)}");
    cstmt.registerOutParameter(1,Types.INTEGER);
    cstmt.setInt(1,1);
    cstmt.execute();
    System.out.println("para = " + cstmt.getInt(1));
    cstmt.close();
    conn.close();
    I get the following errors:
    Exception in thread "main" java.lang.NumberFormatException:
    at java.lang.Integer.parseInt(Integer.java:426)
    at java.lang.Integer.<init>(Integer.java:540)
    at sun.jdbc.odbc.JdbcOdbcCallableStatement.getInt(JdbcOdbcCallableStatement.java:385)
    at test_proc.main(test_proc.java:11)
    How can i get the correct result: 1111
    Note: The Oracle jdbc driver can gets the correct result.
    Pls help me! Thanks!

    Hello,
    I presume you have created the stored procedure with an INOUT parameter?

  • Problem with Stored procedure in JDBC Synch scenario

    Hello Experts,
    I am working on the scenario which is from HTTP <-> to <-> JDBC. It is a synchronouse scenario. We are using Stored procedure in this scenario.
    1) Please send the response structure for it.
    2) here when i am sending request to the Database it is giving me below error :
    Delivery of the message to the application using connection JDBC_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'TCS.PKG_BMF_MANAGE_SERVICE_DATA.PROC_GET_ACTIVE_MF_ESIIDS' (structure 'statement'): java.sql.SQLException: Oracle CLOB Helper: java.lang.AbstractMethodError: java/sql/Clob.setString(JLjava/lang/String;)I. Setting message to status failed.
    One of the field in Database stored procedure is of type CLOB. So can you ppl guide me that what might be the solution for this.
    Any help appriciated.
    Thanks,
    Hetal

    I am using Stored procedure and that is working fine in Oracle
    This is my XI Request structure :
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:read_PROC_GET_ACTIVE_ESIIDS xmlns:ns0="http://reliant.com/xi/BMFR2">
    - <statement>
    - <PROC_GET_ACTIVE_ESIIDS action="EXECUTE">
      <table>TCS.PKG_BMF_MANAGE_SERVICE_DATA.PROC_GET_ACTIVE_MF_ESIIDS</table>
      <in_bmf_partner_id isInput="true" type="VARCHAR">994</in_bmf_partner_id>
      <in_esids isInput="true" type="CLOB">1008901001155950587100:1008901001155950545100:1008901001155950671100:1008901001155950114100</in_esids>
      </PROC_GET_ACTIVE_ESIIDS>
      </statement>
      </ns0:read_PROC_GET_ACTIVE_ESIIDS>
    This is oracle Stored procedure signature :
    PROCEDURE PROC_GET_ACTIVE_ESIIDS
    in_bmf_partner_id           IN   kss_activity_stg_curr_stat.BMF_PARTNER_ID%TYPE,
    in_esids                    IN   CLOB,
    out_recordset               OUT  sys_refcursor
    Let me know if you need any further information.
    Thanks,
    Hetal

  • Problem with Stored Procedure exection in Oracle DB

    Hi,
    I am facing some problem while creating and executing a store procedure.
    Please help me solving my problem.
    Here are the details :
    My Store Procedure :
    PROCEDURE EMP2
    (PROCESSED IN VARCHAR2 ) AS
    BEGIN
    SELECT * FROM EMPLOYEE WHERE PROCESSED ='NO'
    UPDATE EMPLOYEE SET PROCESSED='YES' WHERE PROCESSED='NO'
    COMMIT;END EMP;
    Now I want to execute this SP with the statement,
    EXECUTE EMP2('NO');
    But When I execute this statement, it prompts with this error :
    Error: java.sql.SQLException: ORA-00900: invalid SQL statement
    , SQL State: 42000, Error Code:
    Please help me to solve this issue with high priority.
    Regards,
    Vara.

    surely this is not the case :)
    SQL> create or replace PROCEDURE EMP_PROC
    (P_PROCESSED IN VARCHAR2 ) AS
    BEGIN
    for i in (SELECT * FROM EMP WHERE PROCESSED = P_PROCESSED)
    loop
         UPDATE EMPLOYEE SET PROCESSED='YES' WHERE PROCESSED='NO' and employee.empno=i.empid;
    end loop;
    COMMIT;
    END;
    /  2    3    4    5    6    7    8    9   10 
    Procedure created.
    SQL> exec EMP_PROC('NO');
    PL/SQL procedure successfully completed.

  • Importing function with multiple ref cursors in Stored Procedure of Oracle 12c database Using EF6

    Hi Good day!
    I can able to import function for stored procedure of oracle db and able to add the complex type and get the output but i tried to import the procedure which having two ref cursors and unable to retrieve the column information. Only able to retrieve the
    columns of first ref cursor.  Please help me to get the result of two ref cursors which acting as out parameters.

    Having to ref cursors return mutiple recordsets in an Oracle package is like haveng two resultsets return from a MS SQL Server sparc.
    The link may point you in the right direction.
    http://www.codeproject.com/Articles/675933/Returning-Multiple-Result-Sets-from-an-Entity-Fram

  • Need sample source code for calling stored procedure in Oracle

    Hi.
    I try to call stored procedure in oracle using JCA JDBC.
    Anybody have sample source code for that ?
    Regards, Arnold.

    Thank you very much for a very quick reply. It worked, but I have an extended problem for which I would like to have a solution. Thank you very much in advance for your help. The problem is described below.
    I have the Procedure defined as below in the SFCS1 package body
    Procedure Company_Selection(O_Cursor IN OUT T_Cursor)
    BEGIN
    Open O_Cursor FOR
    SELECT CompanyId, CompanyName
    FROM Company
    WHERE CompanyProvince IN ('AL','AK');
    END Company_Selection;
    In the Oracle Forms, I have a datablock based on the above stored procedure. When I execute the form and from the menu if I click on Execute Query the data block gets filled up with data (The datablock is configured to display 10 items as a tabular form).
    At this point in time, I want to automate the process of displaying the data, hence I created a button and from there I want to call this stored procedure. So, in the button trigger I have the following statements
    DECLARE
    A SFCS1.T_Cursor;
    BEGIN
    SFCS1.Company_Selection(A);
    go_Block ('Block36');
    The cursor goes to the corresponding block, but does not display any data. Can you tell me how to get the data displayed. In the future versions, I'm planning to put variables in the WHERE clause.

  • Calling Stored Procedure from Oracle DataBase using Sender JDBC (JDBC-JMS)

    Hi All,
    We have requirement to move the data from Database to Queue (Interface Flow: JDBC -> JMS).
    Database is Oracle.
    *Based on Event, data will be triggered into two tables: XX & YY. This event occurs twice daily.
    Take one field: 'aa' in XX and compare it with the field: 'pp' in YY.
    If both are equal, then
         if the field: 'qq' in YY table equals to "Add" then take the data from the view table: 'Add_View'.
         else  if the field: 'qq' in YY table equals to "Modify"  then take the data from the view table: 'Modify_View'.
    Finally, We need to archive the selected data from the respective view table.*
    From each table, data will come differently, means with different field names.
    I thought of call Stored Procedure from Sender JDBC Adapter for the above requirement.
    But I heard that, we cannot call stored procedure in Oracle through Sender JDBC as it returns Cursor instead of ResultSet.
    Is there any way other than Stored Procedure?
    How to handle Data Types as data is coming from two different tables?
    Can we create one data type for two tables?
    Is BPM required for this to collect data from two different tables?
    Can somebody guide me on how to handle this?
    Waiting eagerly for help which will be rewarded.
    Thanks and Regards,
    Jyothirmayi.

    Hi Gopal,
    Thank you for your reply.
    >Is there any way other than Stored Procedure?
    Can you try configuring sender adapter to poll the data in intervals. You can configure Automatic TIme planning (ATP) in the sender jdbc channel.
    I need to select the data from different tables based on some conditions. Let me simplify that.
    Suppose Table1 contains 'n' no of rows. For each row, I need to test two conditions where only one condition will be satisfied. If 1st condition is satisfied, then data needs to be taken from Table2 else data needs to be taken from Table3.
    How can we meet this by configuring sender adapter with ATP?
    ================================================================================================
    >How to handle Data Types as data is coming from two different tables?
    If you use join query in the select statement field of the channel then whatever you need select fields will be returned. This might be fields of two tables. your datatype fields are combination of two diff table.
    we need to take data only from one table at a time. It is not join of two tables.
    ================================================================================================
    Thanks,
    Jyothirmayi.

  • Calling stored procedure in Oracle forms

    I have a stored procedure in Oracle which is declared as follows in the package
    SFCS1.Company_Selection(O_Cursor IN OUT T_Cursor, cls IN Varchar2);
    Where T_Cursor is defined as a Ref Cursor
    From the Oracle forms I'm using the following code
    SFCS1.Company_Selection(A,my_cls);
    go_block('Block50');
    Execute_Query;
    I get the error message "FRM40505:Oracle Error: Unable to Perform Query". If I hardcode the value of my_cls in the query it runs properly. Any solutions will be really helpful
    Further to this, I want to put the single quotes around a value (for eg. 'A') from a variable. For instance I'm getting a value from my_cls and for the output I want to surround it with the single quotes, can somebody tell me how to do it.
    Thanks in advance

    This is a bit of a roundabout way to do it? Try setting up the block data source as procedure and set the values in the property palette of the data block.
    e.g.
    Query Data Source Type = Procedure
    Query Data Source Name = SFCS1.Company_Selection
    Query Data Source Columns = (Whatever columns/items you have in your datablock)
    Query Data Source Arguments = Argument names are your ref cursor and your variable.
    Check out basing data blocks on Ref Cursors.
    HTHs
    L :-)

  • How to Create a Stored Procedure in Oracle

    I try to create a very simple Stored Procedure from Oracle SQL Developer, got the following error. Can someone give me some help on this? I am new on this. Thanks.
    Error(4,1): PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following: := ( ; not null range default character The symbol ";" was substituted for "BEGIN" to continue.
    create or replace PROCEDURE Test
    AS ACCESSTYP_ID ACCESSTYP.ACCESSTYPCD%TYPE
    BEGIN
         SELECT ACCESSTYPCD
         INTO ACCESSTYP_ID
         FROM ACCESSTYP
         WHERE ACCESSTYPCD = 'WWW';
    END;

    I found out I forgot to put ";" after the declare.
    How do I test it call this stored procedure from
    Oracle SQL Developer.
    create or replace PROCEDURE Test_VL
    AS ACCESSTYP_ID
    ACCESSTYP.ACCESSTYPCD%TYPE;
         SELECT ACCESSTYPCD
         INTO ACCESSTYP_ID
         FROM ACCESSTYP
         WHERE ACCESSTYPCD = 'WWW';
    END;in your SQL Developer window just enclosed your procedure with a Begin ... End.
      Begin
        Test_VL;
      End;

  • C-stored procedure in Oracle

    Dear Friends,
    I have a lot of c-stored procedures for DB2,
    now,I want to use these c-stored procedures in Oracle directly without any changes.
    I'm not sure whether this method is right.
    Please help me.
    Guang

    I think, that the best way inclusion of business logic into ORACLE database as a TABLE-constraints, triggers and stored procedures for guaranteeing data integrity.
    But if you have really a LOT of c-stored procedures and you need provide quick startup with ORACLE, than you can use your c-procedures as "external calls" with ORACLE.
    Unfortunately I don't know DB2 c-stored procedures specifics and can't give finally recommendations for you.
    Sincerely, Urry

  • Stored procedure in oracle plsql giving Error

    Hi all,
    I want to create stored procedure in oracle.
    In that,I want to update if record is present in the table else want to insert that record in that table.
    Here is my stored proc which I write.
    I have very little knowledge about oracle(to be honest no knowledge).
    Below is my code and the purpose of this code is to insert/update the data based on the entry what ever the user makes in cognos report studio report view.
    Collapse | Copy Code
    create or replace
    PROCEDURE INSERTCOMMENTS
    N_HATID NUMBER
    , N_IN_NUMBER NUMBER
    , N_POINTS VARCHAR2 DEFAULT 255
    , N_QETYPE VARCHAR2 DEFAULT 255
    ) AS
    BEGIN
    IF((SELECT COUNT(*) FROM CCM_REPORT_USER.POINTS_QETYPE_COMMENTS
    WHERE CCM_REPORT_USER.POINTS_QETYPE_COMMENTS.HATID = N_HATID)=0)
    THEN (INSERT INTO "CCM_REPORT_USER"."POINTS_QETYPE_COMMENTS" (HATID, IN_NUMBER, POINTS, QETYPE)
    VALUES (N_HATID , N_IN_NUMBER , N_POINTS , N_QETYPE,));
    ELSE
    (UPDATE "CCM_REPORT_USER"."POINTS_QETYPE_COMMENTS" SET CCM_REPORT_USER.POINTS_QETYPE_COMMENTS.POINTS = N_POINTS
    AND CCM_REPORT_USER.POINTS_QETYPE_COMMENTS.QETYPE = N_QETYPE
    WHERE CCM_REPORT_USER.POINTS_QETYPE_COMMENTS.HATID = N_HATID)
    AND WHERE CCM_REPORT_USER.POINTS_QETYPE_COMMENTS.IN_NUMBER = N_IN_NUMBER)
    END IF;
    END INSERTCOMMENTS;

    948677 wrote:
    I want to create stored procedure in oracle.
    I have very little knowledge about oracle(to be honest no knowledge).If you are new to Oracle you should first be familiar with the manuals before writing code
    http://tahiti.oracle.com/
    For the latest version
    http://www.oracle.com/pls/db112/homepage
    And then start with *2 Day Developer's Guide*
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10766/toc.htm
    SQL Language Reference
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/toc.htm
    Concepts
    http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/toc.htm
    PL/SQL Language Reference
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17126/toc.htm
    And the Error Messages references for looking up the errors you will encounter when starting out
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17766/toc.htm
    >
    In that,I want to update if record is present in the table else want to insert that record in that table.
    Here is my stored proc which I write.Once you know where the manuals are you would see that you would not write a stored procedure, you would use the MERGE command to do this
    http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_9016.htm#i2081218
    Which you can of course put in a stored procedure if you like.

Maybe you are looking for

  • How to format a currency value

    Hi, I have an internal table with a field of type cosp-wtg001 (data type CURR length 15). Field works fine (it stores well the value and this sort of things) but when I store internal table into a file (with GUI_DOWNLOAD function) negative values app

  • Changing the Listener Port Number

    Hi RACers, I need to change the TNS listener port number from the default of 1521 (don't ask!). I'm on Solaris10/Oracle10g 10.2.0.3 using a 2 node cluster. I've tried editing the relevant files, bouncing everything and re-starting CRS, but that doesn

  • Documents shared from Pages only open in browser?

    I showed my wife how to use the new Share (collaboration) feature in Pages. She sent me a link to a Pages document via Messages, and I received the link in Messages. But clicking the link opens the file in Safari. While that is ok (it works),  I'd pr

  • Urgent!!! How to use IN_PARAMETER in CONSTRUCT_BSP_URL method

    Hi sdn, Iam new to bsp.I created a application with 2 controllers and 2 views.i want to transfer the values from one controller to another controller by using the runtime->construct_bsp_url(). in that one parameter " in_parameter" is used to pass the

  • HTML/CSS animation clipped on iPad

    Hi list... When inserting html into an inDesign document intended to be published as an iPad app, I'm running into issues with seeing the entire html.  The bounding box that holds the html collapses down to the size of the "This is arbitrary html" me