selection of lines by using the stored procedure

All the

At the risk of asking something obvious, I would like to know if it is possible to wrap a selection within a stored procedure.

Create the abc as procedure

Start

date of b;

Select sysdate into double b;

end;

/

Question: I have a select complex which should be called from JAVA. I don't want to create a VIEW since at the request of the view, indeed I will do so: SELECT * FROM (my original query) which leads to performance.

I would like to be able to:

exec has;

This should give me the result of

SELECT

x, z, c

Of

one

;

How can I make this possible a stored procedure?

Thank you

Well, yes there are ways to do it, but first of all, you are mistaken in thinking that select * from , would lead to a performance overhead.  The optimizer based on CSSTidy will optimize the request to provide results without worrying so there is no noticeable performance difference.

Java, you probably want to use a ref cursor and get java to retrieve the results back.

Example of refcursor function (demonstrated SQL * more I don't have Java)...

SQL > create or replace function test RETURN as sys_refcursor
cur_o 2 sys_refcursor;
3. start
4. open cur_o to select empno, ename from emp;
5 return cur_o;
6 end;
7.

The function is created.

SQL > var r refcursor;
SQL > exec: r: = test();

PL/SQL procedure successfully completed.

SQL > print r;

EMPNO, ENAME
---------- ----------
7369 SMITH
7499 ALLEN
7521 WARD
7566 JONES
7654 MARTIN
7698 BLAKE
7782 CLARK
7788 SCOTT
KING 7839
7844 TURNER
7876 ADAMS
JAMES 7900
7902 FORD
7934 MILLER

14 selected lines.

Tags: Database

Similar Questions

  • Use the stored procedure to create the data model for the bi publisher report

    Hi all

    Can we use stored procedure to create the data model for BI Publisher reports? I did find an example by using the stored procedure to complete the data model in the bi publisher report.

    Thank you

    Virat

    Check out these links

    BI publisher to use the stored procedure
    Re: Stored procedures and dynamic columns
    Re: Is it possible to use stored procedures in BI Publisher GUI?
    Re: PL/SQL stored w / model XML?

    If brand pls help

  • Cross-Schema insert by using the stored procedure

    Hi all.

    I am currently migrating 11.2.0.1 to 11.2.0.3,
    and I have to deal with an unexpected privileges error "ORA-13199: insufficient privilege for the table in the application of the xxx model."

    While inserting triplets in the table in the application of the model
    using a stored procedure which is
    owned by the owner of model table and app,
    but called by another issued user.

    There has never been a problem 10.2.0.4 or 11.2.0.1.
    It seems that something has really changed, (perhaps an authid pragma or something like this in the code internal SDO_RDF_TRIPLE?)
    The two users are needed on my system for security policy reasons.



    Here's a simplified script to reproduce the success on 1.2.0.1 and error on 11.2.0.3.
    Users are: ADMWAT = model, USEWAT = calling application


    SQL > connect SYS/xxxxx@DB_*11201*.world as sysdba
    Connected.
    SQL > select value of MDSYS. RDF_PARAMETER where namespace = "MDSYS" and the attribute = "SEM_VERSION";

    VALUE
    --------------------------------------------------------------------------------
    * 112 *.

    SQL >
    SQL > connect ADMWAT/xxxxx@DB_11201.world
    Connected.
    SQL > CREATE TABLE family_rdf_data (id NUMBER, triple SDO_RDF_TRIPLE_S);

    Table created.

    SQL >
    SQL > exec SEM_APIS.create_rdf_model ('family', 'family_rdf_data', 'three');

    PL/SQL procedure successfully completed.

    SQL >
    SQL > GRANT INSERT ON family_rdf_data in MDSYS.

    Grant succeeded.

    SQL >
    SQL > create or replace PROCEDURE NEW_TRIPLE IS
    BEGIN 2
    3 INSERT INTO family_rdf_data VALUES (1,
    4 SDO_RDF_TRIPLE_S ('family',
    5 "http://www.example.org/family/John."
    6 "http://www.example.org/family/fatherOf."
    7 'http://www.example.org/family/Suzie'));
    8 END;
    9.

    Created procedure.

    SQL >
    SQL > GRANT EXECUTE ON NEW_TRIPLE to USEWAT;

    Grant succeeded.

    SQL >
    SQL > connect ADMWAT/xxxxx@DB_11201.world
    Connected.
    SQL > exec ADMWAT. NEW_TRIPLE();

    PL/SQL procedure successfully completed.

    SQL > rollback;

    Complete restoration.

    SQL >
    SQL > connect USEWAT/xxxxx@DB_11201.world
    Connected.
    SQL > exec ADMWAT. NEW_TRIPLE();

    PL/SQL procedure successfully complete.

    SQL >
    SQL >
    SQL >

    ************************************************************************************************************
    ************************************************************************************************************
    ************************************************************************************************************

    SQL > connect SYS/xxxxx@DB_*11203*.world as sysdba
    Connected.
    SQL > select value of MDSYS. RDF_PARAMETER where namespace = "MDSYS" and the attribute = "SEM_VERSION";

    VALUE
    --------------------------------------------------------------------------------
    * 11203 *.

    SQL >
    SQL > connect ADMWAT/xxxxx@DB_11203.world
    Connected.
    SQL >
    SQL > CREATE TABLE family_rdf_data (id NUMBER, triple SDO_RDF_TRIPLE_S);

    Table created.

    SQL >
    SQL > exec SEM_APIS.create_rdf_model ('family', 'family_rdf_data', 'three');

    PL/SQL procedure successfully completed.

    SQL >
    SQL > GRANT INSERT ON family_rdf_data in MDSYS.

    Grant succeeded.

    SQL >
    SQL > create or replace PROCEDURE NEW_TRIPLE IS
    BEGIN 2
    3 INSERT INTO family_rdf_data VALUES (1,
    4 SDO_RDF_TRIPLE_S ('family',
    5 "http://www.example.org/family/John."
    6 "http://www.example.org/family/fatherOf."
    7 'http://www.example.org/family/Suzie'));
    8 END;
    9.

    Created procedure.

    SQL >
    SQL > GRANT EXECUTE ON NEW_TRIPLE to USEWAT;
    Grant succeeded.

    SQL >
    SQL > connect ADMWAT/xxxxx@DB_11203.world
    Connected.
    SQL > exec ADMWAT. NEW_TRIPLE();

    PL/SQL procedure successfully completed.

    SQL > rollback;

    Complete restoration.

    SQL >
    SQL > connect USEWAT/xxxxx@DB_11203.world
    Connected.
    SQL > exec ADMWAT. NEW_TRIPLE();
    BEGIN ADMWAT. NEW_TRIPLE(); END;

    *
    ERROR on line 1:
    ORA-55303: SDO_RDF_TRIPLE_S constructor failed:

    SQLERRM = ORA-13199: insufficient privilege for the application of the model family table [
    ORA-06512: at the 'MDSYS. MD", line 1723
    ORA-06512: at the 'MDSYS. MDERR", line 17
    ORA-06512: at the 'MDSYS. SDO_RDF_TRIPLE_S', line 41
    ]
    ORA-06512: at the 'MDSYS. MD", line 1723
    ORA-06512: at the 'MDSYS. MDERR", line 17
    ORA-06512: at the 'MDSYS. SDO_RDF_TRIPLE_S', line 68
    ORA-06512: at "ADMWAT. NEW_TRIPLE', line 3
    ORA-06512: at line 1


    SQL >

    Published by: damien.claveau on March 26, 2012 02:02

    Damien,

    Please submit a Service request for this issue in Support of Oracle.

    Meanwhile, until a patch will be available, another possible solution, you could consider to use is to grant the DBA role to ADMWAT.

    If you want, please contact me directly by email: souripriya das at oracle dot com dot

    Thank you
    -Smiled.

  • Using the stored procedure

    We use the procedure attached to within an ASP application obfuscation of the password database. I am able to use the same procedure in CF without modification? Right now, I have tried with cfstoredproc but'm "Procedure 'dt_External_Encrypt' expects parameter '@Encrypted', which was not supplied."



    You do not use the ODBC driver.

    Most likely, there is a typing error in the code or the stored procedure is not also displayed (or a copy).

    Change procedure = "dt_External_Encrypt" to procedure = "dbo.dt_External_Encrypt" "

    Open Query Analyzer, 'Edit' code stored procedure and make sure that it is really such displayed.

    Finally, try changing returnCode 'no '.

    If all else fails, join the code exact CF code and code from Query Analyzer.

  • Using the stored procedure: Source does not have a target executable

    I'm a guy from MS - SQL, so I'm fairly familiar with T - SQL syntax, but feels a heck of a time trying to take the code I wrote for SQL and turn this works with Oracle.

    in any case, I'm using Oracle SQL Developer, and I have a stored procedure that calls the Alter Table statement and adds a column. Just trying to get this one to work before moving on to the other that I have. I get the message that source does not have a target executable when I try to run this command.

    create or replace PROCEDURE rta_conv_addcolumn (rtatablename1 in varchar (20),)
    rtatablename2 in varchar (20),
    rtacolumnname in varchar (256),
    rtacolumninfo in varchar (256))
    AS
    DECLARE rtasql VARCHAR (4000);
    BEGIN
    IF EXISTS (SELECT * from user_tables WHERE table_name = rtatablename1)
    AND NOT EXISTS (SELECT * from user_tab_columns WHERE column_name = rtacolumnname)
    AND table_name = rtatablename1)
    AND NOT EXISTS (SELECT * from user_tab_columns WHERE column_name = rtacolumnname)
    AND table_name = rtatablename2)
    Then rtasql: = ' ALTER TABLE ["+ rtatablename2 +"] ADD "+ rtacolumnname +" "+ rtacolumninfo;
    Run (rtasql);
    END rta_conv_addcolumn;

    If I try to compile I get the following messages, which make no sense, since the syntax I use to declare the input variables seems to be good.

    Error (1.54): PLS-00103: encountered the symbol "(" quand attend une deles de valeurs suivantes:: =.), @ default % of the characters of the symbol ': = ' has been replaced by "(" pour continuer.)
    Error (2.29): PLS-00103: encountered the symbol "(" quand attend une deles de valeurs suivantes:: =.), @ default % of the characters of the symbol ': = ' has been replaced by "(" pour continuer.)
    Error (3.29): PLS-00103: encountered the symbol "(" quand attend une deles de valeurs suivantes:: =.), @ default % of the characters of the symbol ': = ' has been replaced by "(" pour continuer.)
    Error (4.29): PLS-00103: encountered the symbol "(" quand attend une deles de valeurs suivantes:: =.), @ default % of the characters of the symbol ': = ' has been replaced by "(" pour continuer.)
    Error (6.1): PLS-00103: encountered the symbol "DECLARE" when expecting one of the following: begin function package pragma procedure < an ID > subtype type use < a between double quote delimited identifiers of > form current cursor external language the symbol 'start' is substituted for 'SAID' continue.
    Error (15.5): PLS-00103: encountered the symbol "RTA_CONV_ADDCOLUMN" when expects it one of the following values: If

    Adds the column to the table specified in rtatablename1, if there is neither rtatablename1 nor rtatablename2.

    NOT TESTED

    create or replace PROCEDURE rta_conv_addcolumn(rtatablename1 in varchar,
    rtatablename2 in varchar,
    rtacolumnname in varchar,
    rtacolumninfo in varchar)
    AS
    rtasql VARCHAR(4000);
    count1 number;
    count2 number;
    count3 number;
    BEGIN
      SELECT count(*) into count1 FROM user_tables WHERE table_name = rtatablename1;
      SELECT count(*) into count2 FROM user_tab_columns WHERE column_name = rtacolumnname AND table_name = rtatablename1;
      SELECT count(*) into count3 FROM user_tab_columns WHERE column_name = rtacolumnname AND table_name = rtatablename2;
      IF count1>0 AND count2 = 0 AND count3=0 Then
        rtasql:= 'ALTER TABLE '|| rtatablename1 ||'ADD ' || rtacolumnname || ' ' || rtacolumninfo;
        Execute immediate rtasql;
      END IF;
    END rta_conv_addcolumn;
    /
    

    Max

    Published by: Massimo Ruocchio, December 12, 2009 02:15
    Missing AND

  • Problem to INSERT INTO using the stored procedure in 10g

    I use a 10g R2 database.

    I created two tables as follows:
    SQL > create table t1 (c1 varchar2 (1), number (1) c2, c3 number (1);)
    SQL > create table t2 (deptid varchar2 (4), empid varchar (4), varchar2 (1) c1, c2 number (1) c3 number (1);)

    insert into t1 values ('A', 3, 5);
    insert into t1 values ('B', 5, 5);
    insert into t1 values ('C', 5, 5);

    I want to create a stored procedure to insert data into table t1 t2 and certain parameters of the procedure.
    Is this possible?
    As an example:
    SQL > execute test (1,2)

    This procedure will be insert these two parameters in table t2 AND select rows in table t1 and insert into table t2 at the same time.
    How can I write the procedure?
    Tip:
    SQL > create or replace procedure
    (v_deptid, v_empid number)
    is
    BEGIN
    Insert into t2 (deptid, empid, c1, c2, c3)
    ... Select c1, c2, c3 from t1;
    end;

    My question is: How can I insert the v_deptid and v_empid parameters at the same time?

    Try

    SQL > create or replace procedure
    (v_deptid, v_empid number)
    is
    BEGIN
    Insert into t2 (deptid, empid, c1, c2, c3)
    Select v_deptid, v_empid, c1, c2, c3 to t1;
    end;

  • use the stored procedure VARIABLE in an ODI procedure

    Hello

    I have a stored procedure that takes custId as an input parameter and returns the age as output parameter.

    custId is a varaible ODI that we spend during execution.

    I want to insert the age value in a table.

    declare
    cust_age customer_details.age%type;
    Start
    FETCH_CUSTOMER_DATA(#Customer.CustomerID,cust_age);
    end;

    INSERT INTO CUSTOMER_AGE VALUES(#customerid,*cust_age*)

    Thank you.

    Hello

    Just use the insert in an ODI procedure in an anonymous pl/sql block.

    I mean:

    declare

    cust_age customer_details.age%type;

    Start

    FETCH_CUSTOMER_DATA(#Customer.CustomerID,cust_age);

    INSERT INTO CUSTOMER_AGE VALUES(#customerid,*cust_age*);

    end;

    Ok?

    Cezar Santos
    http://odiexperts.com

  • by using the stored procedure in sql statement?

    I have the following sample tables:

    project id project name
    ====== ===============
    1 project one
    2 two project
    3 three of the project


    employee_id fname lname
    =========== =============     =====
    Amy 100a
    Better B 200
    Carrie 300 C


    project number
    ===========     ===========
    1,200 people
    2 300
    of 3 100

    There's a getFullname (empployee_id) of the procedure in place that combines the fname lname full name

    what I need to accomplish is the following.

    project is created by employee
    ==============================
    project a is created by better b
    two project is created by carrie C
    three project is created by amy A

    but the rule is: you need to call the getFullName (employee_id) procedure to perform the above task and do not use join tables to get the employee full name

    I suspect that you want something along the lines of

    SELECT 'Project ' || p.project_name || ' was created by ' || get_full_name( pe.employee_id )
      FROM project p,
           project_employee pe
     WHERE p.project_id = pe.project_id
    

    If you need other attributes in the employee table, you can join at the table of the employees as well.

    Justin

  • Maximum number of parameters sent to the stored procedure

    I have a web form where I insert data in Oracle. There are at least 20 fields on the form. For the INSERT, I want to use the stored procedure. But in this case for the section of the VALUES in the INSERT statement, I need to send that many - in this case 20 settings. Is it normal for a procedure to receive 20 parameters? If this isn't the case, then should how I follow to do? I know that technically there is only no problem but isn't normal programming or database managementwise? I think it's the basic thing any developer web do it all the time.

    Is it normal for a procedure to receive 20 parameters?

    Sure. It is very good.

    But what is normal programming or database managementwise

    If you need to insert values for 20 fields then normal.

  • can I export and import my database to oracle via the stored procedure?

    Hi all

    I need to export my database using the stored procedure, the stored procedure is called by the java application and it works well
    Now I still get the "ULTIMATE QUESTION", could export and import the database using the stored procedure?

    Really thanks for the reply.

    Kind regards

    Kahlil

    Hello

    I think you can use DBMS_DATAPUMP (10.1 +), see [DBMS_DATAPUMP | http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_datpmp.htm#i1007277], for examples, see [http://www.psoug.org/reference/dbms_datapump.html]

    Kind regards

  • How can I transfer content from an XML file in a MS SQL database of the stored procedure using LabWindows/CVI SQL Toolkit?

    Hello

    I have a problem to transfer content to an XML file in a MS SQL database through a stored procedure data/fixed. I am able to transfer the content of the file using method...

    HSTMT = DBPrepareSQL (hdbc, EXEC usp_InsertReport " ... ");

    resCode = DBExecutePreparedSQL (hstmt);

    resCode = DBClosePreparedSQL (hstmt);

    ... but in this case, I am not able to read the return value of the stored procedure.

    I tried to follow the example of the stored procedure in the help documentation (DBPrepareSQL), but I miss a xml data type?

    No idea how to solve my problem?

    Cake of KR

    DianaS salvation,

    Thanks for your comments. During this time I found another way which fullfill my needs:

    resCode = DBSetAttributeDefault (hdbc, ATTR_DB_COMMAND_TYPE, DB_COMMAND_TEXT);

    sprintf (sz_SqlStatement, "DECLARE @TESTID INT EXEC @TESTID = usp_InsertReport ' SELECT 'RetVal' %s = @TESTID", sz_Buffer ");
    HSTMT = DBActivateSQL (hdbc, sz_SqlStatement);

    While ((resCode = DBFetchNext (hstmt)) == DB_SUCCESS)

    {

    / * Enter values in the record. */

    resCode = DBGetColInt (hstmt, 1, & s32_TestId);
    }

    resCode = DBDeactivateSQL (hstmt);

    sz_Buffer is the content of the XML file.

    Cake of KR

  • user_table should be used in the stored procedure.

    Hello

    I want to find my permanent table user_tables and then drop and recreate it,

    I can use this user_tables in my stored procedure for above purpose or is there any notice that must be used.

    SP is admin sp, used to run in offline mode.

    yorus truly

    Published by: 944768 on 10 February 2013 23:44

    Published by: 944768 on 10 February 2013 23:44

    944768 wrote:
    but I wanted to know that can I use user_table in above proc stored to conclude and then drop and create it when Everitt runs?

    Oracle manages two "flavors" of the stored procedure - copyright and rights of the Summoner. Rights of the DEFINER (default) is always performed under stored security area of the owner of the procedure no matter who calls it. So, if you ask USER_TABLES (or any display USER_, besides) within DEFINER rights stored procedure, you will get a list of tables owned by the owner of the stored procedure, not stored calling procedure. Rights (AUTHID CURRENT_USER) stored Invoker procedure is always carried out under the domain of the calller security. Therefore, if you are querying USER_TABLES (or any display USER_, besides) within the Summoner rights stored procedure you will get a list of tables belonging to the appellant a stored procedure. Hope it answers your question.

    SY.

  • Materialized view, based on the stored procedure

    Hi all

    is it possible to create a materialized view on the results returned by a stored procedure?

    If this is not the case, do you think that any other way except for filling a table with data from the stored procedure and then founded the MV on it?

    Thanks in advance.

    MichaelTsilikidis wrote:

    Sorry I don't speak properly. In fact the procedure does not return a value, it fills one of its parameters (of the ref cursor type) of data. That's what I wanted.

    No it's not.

    REF CURSOR don't store data, so it's not possible.

    A Ref cursor is just a pointer to a query... and you can't "select from" a ref cursor, you can retrieve only one open.

    PL/SQL 101: Understand the Ref Cursor

    As correctly stated above, you can't question from a procedure to a function, and a materialized view is based on a query, you cannot use a procedure in a materialized view.

    You could use a function pipeline instead of a procedure, or have the pipeline function obtain the results of the procedure and pipelines, and then the materialized view could be based on the results of this function in the pipeline.

    example of function pipeline:

    SQL > CREATE or REPLACE TYPE AS OBJECT num_descript (num number, descript varchar2 (30))
    2.

    Type of creation.

    SQL >
    SQL > CREATE or REPLACE TYPE tbl_num_descript AS TABLE OF THE num_descript
    2.

    Type of creation.

    SQL >
    SQL >
    SQL > CREATE or REPLACE PACKAGE AS-reftest
    2 FUNCTION pipedata (number p_choice) tbl_num_descript RETURN PIPELINED;
    3 END;
    4.

    Package created.

    SQL >
    SQL > CREATE or REPLACE PACKAGE BODY AS-reftest
    2 FUNCTION pipedata (number p_choice) tbl_num_descript RETURN PIPELINED IS
    3 v_obj num_descript: = num_descript (NULL, NULL);
    4 v_rc sys_refcursor;
    5 BEGIN
    6. IF p_choice = 1 THEN
    7 v_rc OPEN to SELECT empno as num, ename like descript FROM emp;
    8 ELSIF p_choice = 2 THEN
    9 OPEN v_rc to SELECT deptno as num, dname as descript OF THE Department;
    10 END IF;
    11 LOOP
    12 FETCH v_rc INTO v_obj.num, v_obj.descript;
    EXIT 13 WHEN v_rc % NOTFOUND;
    14 PIPE ROW (v_obj);
    15 END LOOP;
    16 v_rc NARROW;
    RETURN 17;
    18 END;
    END 19;
    20.

    Package body created.

    SQL > select * from table (reftest.pipedata (1));

    DESCRIPT NUM
    ---------- ------------------------------
    7369 SMITH
    7499 ALLEN
    7521 WARD
    7566 JONES
    7654 MARTIN
    7698 BLAKE
    7782 CLARK
    7788 SCOTT
    KING 7839
    7844 TURNER
    7876 ADAMS
    JAMES 7900
    7902 FORD
    7934 MILLER

    14 selected lines.

    SQL > select * from table (reftest.pipedata (2));

    DESCRIPT NUM
    ---------- ------------------------------
    10 ACCOUNTING
    SEARCH 20
    30 SALES
    40 OPERATIONS

  • Error on the definition of the stored procedure in the simultaneous program

    Hello

    I created a stored procedure and wanted it attached to the concurrent program. The purpose of this stored procedure when you run it in simultaneous program, the system retrieves the data from the csv file downloaded from the server, then it will insert in the tables of SO / the Interface API. Below, the error occurred.


    * Starts * 18 April 2012 18:18:42
    Error ORACLE 6550 in FDPSTP

    Cause: FDPSTP failed due to the ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in the call to 'SPKO1 '.
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored

    Steps I did to set the stored proc
    < < simultaneous executable program > >

    Executable: RDRAGON_SO_IMPORT
    Short name: RDRAGON_SO_IMPORT
    Application: Order management
    Method of execution: PL/SQL, stored procedure
    Run file name: SPKO1

    < < concurrent program - set > >

    Program: RDRAGON SO IMPORT
    Short name: RDRAGON_SO_IMPORT
    Application: Order management
    Name of executable: RDRAGON_SO_IMPORT
    Method: PL/SQL, stored procedure

    Format: text
    No set

    -Here are my stored procedure-


    CREATE OR REPLACE PROCEDURE APPS. SPKO1 IS
    FH UTL_FILE. TYPE_DE_FICHIER;
    v_line VARCHAR2 (32767).
    v_source_id NUMBER (10);
    v_created_by NUMBER (10);
    v_creation_date DATE;

    v_org_id NUMBER (10);
    v_orig_sys_docref VARCHAR2 (50);
    V_Customer VARCHAR2 (360);
    v_customer_prev VARCHAR2 (360);
    v_sold_to_org NUMBER (10);

    v_orig_line_ref NUMBER (10);
    v_item_code VARCHAR2 (2000);
    v_ordered_qty NUMBER (10);
    v_selling_price NUMBER (10);
    v_count NUMBER (10);
    v_stat NUMBER;


    /******************************************************************************
    NAME: SPKO
    PURPOSE:

    REVISIONS:
    Worm Date Description of the author
    --------- ---------- --------------- ------------------------------------
    1.0 16/04/2012 administrator 1. Created this procedure.

    NOTES:

    Keywords to replace automatically available Auto:
    Object name: SPKO
    SYSDATE: 16/04/2012
    Date and time: 16/04/2012, 17:55:42 and 16/04/2012 17:55:42
    Username: admin (set in Options of TOAD, editor of the procedure)
    Name of the table: (defined in the dialog box "New PL/SQL object")

    ******************************************************************************/
    BEGIN
    v_source_id: = 6;
    v_created_by: = - 1;
    v_org_id: = 204;
    v_customer_prev: = null;
    v_orig_line_ref: = 0;
    v_stat: = 0;

    SELECT header_id in (DE) v_orig_sys_docref
    Select header_id
    of OE_ORDER_HEADERS_ALL
    creation_date desc order
    ) WHERE ROWNUM = 1;


    FH: = UTL_FILE. FOPEN ('XXANDDIR2', 'myfile1.csv', 'R', 32767);
    < < file_read_lines > >
    LOOP
    BEGIN
    UTL_FILE. GET_LINE (fh, v_line);

    V_Customer: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 1") ',' "') ','" ');
    v_creation_date: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 2") ',' "') ','" ');
    v_item_code: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 3") ',' "') ','" ');
    v_ordered_qty: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 4") ',' "') ','" ');
    v_selling_price: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 5") ',' "') ','" ');
    v_orig_line_ref: = (v_orig_line_ref + 1);

    If v_stat = 0 then
    v_orig_sys_docref: = (v_orig_sys_docref + 1);
    end if;

    SELECT hca.cust_account_id from v_sold_to_org
    OF hz_cust_accounts AOB.
    HP hz_parties
    WHERE hca.party_id = hp.party_id
    AND hca.request_id is null
    AND hp.party_name = v_customer;

    If v_stat = 0 then
    INSERT INTO OE_HEADERS_IFACE_ALL)
    order_source_id,
    orig_sys_document_ref,
    org_id,
    CREATION_DATE,
    created_by,
    last_update_date,
    last_updated_by,
    operation_code,
    sold_to_org_id,
    booked_flag)
    VALUES)
    v_source_id,
    ('TEST' | v_orig_sys_docref).
    v_org_id,
    v_creation_date,
    v_created_by,
    v_creation_date,
    v_created_by,
    "INSERT."
    v_sold_to_org,
    'Y') ;
    commit;
    end if;

    INSERT INTO OE_LINES_IFACE_ALL)
    order_source_id,
    orig_sys_document_ref,
    orig_sys_line_ref,
    inventory_item,
    org_id,
    ordered_quantity,
    unit_selling_price,
    unit_list_price,
    CREATION_DATE,
    created_by,
    last_update_date,
    last_updated_by,
    operation_code)
    VALUES)
    v_source_id,
    ('TEST' | v_orig_sys_docref).
    v_orig_line_ref,
    v_item_code,
    v_org_id,
    v_ordered_qty,
    v_selling_price,
    v_selling_price,
    v_creation_date,
    v_created_by,
    v_creation_date,
    v_created_by,
    "INSERT");
    commit;

    v_customer_prev: = v_customer;
    If v_customer_prev = v_customer then
    v_stat: = 1;
    on the other
    v_stat: = 0;
    end if;
    -DBMS_OUTPUT. Put_line ('Col1: ' | v_source_id |', Col2: ' | v_creation_date |', Col3: ' | v_created_by |', Col4: ' | v_updated_date |', Col5: ' | v_updated_by);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    OUTPUT file_read_lines;
    END;
    END LOOP;
    SELECT count (*) in the OE_HEADERS_IFACE_ALL v_count;
    DBMS_OUTPUT. Put_line (' record Total inserted successfully: ' | v_count);
    UTL_FILE. FCLOSE (FH);

    END SPKO1;
    /


    But when I run the stored procedure using TOAD his work.

    Help, please. This is my first time to attach the stored procedure in the concurrent program.

    Thank you very much.

    Kind regards
    Diane

    Published by: peopsquik08 on April 18, 2012 03:58

    as clive_t solier
    >
    You must explicitly reference the settings out
    >

    Try

    DECLARE
    VFILE VARCHAR2(32767);
    V_SOURCE_ID NUMBER;
    --
    ERRBUF VARCHAR2(200);
    RETCODE NUMBER;
    
    BEGIN
    VFILE := 'myfile1.csv';
    V_SOURCE_ID := 6;
    
    --APPS.OMORDERLOADER.SPKO1 ( VFILE, V_SOURCE_ID );
    --COMMIT;
    
    APPS.OMORDERLOADER.SPKO1(
        ERRBUF => ERRBUF,
        RETCODE => RETCODE,
        VFILE => VFILE,
        V_SOURCE_ID => V_SOURCE_ID
      );
    END;
    

    but the code above to test your proc

    to run concurrent SQL, you can use fnd_submit.submit_program

  • In a table - looping through the rows and the stored procedure call

    APEX version: 3.2.0.00.27

    Hello

    I searched the forum and tried a few things but could not make it work.

    I have a tabular presentation, developed with the help of the ATD (Cascading LOV - method of tabular presentation - AJAX - ATD )

    What I'm trying to do now:
    -After submit and validations, loop through all the lines and
    -call a stored procedure passing 3 parameters obtained from each of the lines on the form of tables. This procedure will be an update of a database table.

    On the forum, I found that I could do the loop "* FOR i IN 1..." APEX_APPLICATION.g_f03. "LOOP COUNT *" syntax.

    Only for testing purposes, I tried just to view information with the following (On Load - after a footer) process (example of Denes Kubicek == > http://deneskubicek.blogspot.com/2009/05/execute-javascript-throuhg-plsql.html):
    declare
      v_today  varchar2 (200);
    begin
    --  :P40_test := APEX_APPLICATION.g_f03(1);
    --  :P40_test2 := APEX_APPLICATION.g_f04.COUNT;
      :P40_test2 := 100;
    
      v_today := to_char (sysdate, 'dd.mm.yyyy');
    
    --FOR i IN 1.. APEX_APPLICATION.g_f03.COUNT LOOP 
    
      :P40_test := APEX_APPLICATION.g_f02(2);
    
      HTP.p ('<script type="text/javascript">');
      HTP.p (   'alert(''Today is '
              || v_today
    --          || APEX_APPLICATION.g_f04(APEX_APPLICATION.g_f03(i))
              || '.\n'
              || 'end!'');'
             );
      HTP.p ('</script>');
    
    --    :P40_test := APEX_APPLICATION.g_f02(APEX_APPLICATION.g_f02(i));
    
    --END LOOP;
    
    end;
    The foregoing would give me a ' * ORA-01403: no data found * ' message. I tried through various variants of APEX_APPLICATION.g_f0* #*, but still can't get anything to display correctly. In commenting on all the lines referring to APEX_APPLICATION.g_f0x above, the date would be are they displayed fine.

    I tried uncomment the FOR... LOOP and play with the code (defining the process runs "On submit - after calculations" and Validations), I got was a ' * ORA-06502: PL/SQL: digital error or value: character conversion number error * "message.

    Here is the script of the form in a table:
    select 
    "V"."MSLINK",                                       -- hidden (number)
    "V"."INSTALLATION_DATE",                        -- editable date picker
    "V"."MANUFACTURER_INDICATOR",              -- editable (cascading LOV -- text)
    "V"."MODEL_INDICATOR",                           -- editable (cascading LOV -- text)
    "V"."DIAMETER_INDICATOR",                      -- editable (LOV -- number)
    "V"."PURPOSE_INDICATOR",                        -- editable (LOV -- text)
    "V"."VALVE_NUMBER",                                -- shown but not editable -- number
    "V"."MODIFY_DATE",                                  -- shown but not editable
    "V"."MODIFY_USER",                                   -- shown but not editable
    "V"."VALVES_STYLE"."FEATURE"                  -- shown but not editable -- number
    from "#OWNER#"."VALVES" "V"
    Where
      "V"."PROJECT_ID" = :P1_PROJECT_NUMBER AND
      "V"."VALVES_DFLAG" = 0
    Regarding the parameters for the stored procedure, it would the MSLINK, VALVE_NUMBER and the VALVES_STYLE. FEATURE.

    Help, please!
    (Sorry for the long post).

    Thank you

    Tan

    Hi, Tan,

    I have not seen that type of object - I've only used custom types for purposes of test years ago and have never used their within Apex!

    One possibility is that the value of checksum being is based on all of the content of these fields, rather than only the part of the FEATURE. If there are other parts of the object, you could include those items as well.

    Otherwise, as you f01 KP for a record, you will need to retrieve the values of the FUNCTION in your PL/SQL code directly from the table (because the user cannot modify these fields, you can be sure that the values in the table will be still valid).

    Andy

Maybe you are looking for

  • Can TEMPRO - I select the language

    HelloI installed the software and I get messages. My system is configured all the English (United Kingdom) but I have fun cell phone in France, and I get all my messages in French. So, how can I change this so that all messages are in English and not

  • Satellite P70 - Has: win 8.1: unknown device ACPI\TOS620A

    Hello I installed the Version of Enterprise 8.1 Win on my P70 - A Satellite. All devices in addition to ACPI\TOS620A\2 & DABA3FF & 2 are supported with the right drivers. Does anyone know which device is, for example the Bluetooth Driver?The Device M

  • Programs open to showing only top left of the screen and some programs are huge

    origin: headache Visual, even to post this question I have a dell dimension 3000Win XP SP3 I have a problem with my video in general: everything happens in my screen showing that only the upper left corner of the screen when I open my browser and com

  • THE MORE ME COMO PRINTS DOBLE

    Espero me can help, to me atoro UN papel y todo enough según yo, pero al momento of print print me como doble, y obvio no nada to understand, are busque alguna minimum amount of papel paro nada y también el los multi test I made. Agradesco su respues

  • Photosmart C5280 lo more long runs on CD.

    The printer is no longer recognized as being able to rpint on CD so he says. I tried to install a usb printer connection and selecting the drivers C5300 series but this doesn't. t work either. What third-party software can use this printer to do this