Create a stored procedure

This procedure works fine, but I want to make a stored procedure to schedule it to run over time. I'd appreciate any help?

SET SERVEROUTPUT SIZE 1000000
declare
cursor obj_cursor (objname Varchar2) is
Select object_name, object_type, owner
from dba_objects
where owner = 'ITA '.
and object_type IN ('TABLE', 'SEE')
and object_name like '% JOB_;

cursor c_job_status is
SELECT ownerid jobid, starttime, endtime
OF ita.tpis32_job_status
WHERE starttime < sysdate - 800
AND num_lines > 10000000;
WK_SQL VARCHAR2 (500);
WK_JOBSTR VARCHAR2 (500);
BEGIN
for c_job loop c_job_status
wk_jobstr: = 'JOB_ | c_job. JobID | '%';
for wk_rec loop obj_cursor (wk_jobstr)
If wk_rec.object_type = "TABLE" then
wk_sql: = 'drop table' |' ITA.' | wk_rec.object_name | ';';
dbms_output.put_line (wk_sql);
end if;
If wk_rec.object_type = "DISPLAY" then
wk_sql: = 'drop view ' | wk_rec.object_name | ';';
dbms_output.put_line (wk_sql);
-Wk_sql EXECUTE IMMEDIATE.
end if;
end loop;
end loop;
end;
I tried this, but it did work ' t:
create or replace procedure delete_table is
SET SERVEROUTPUT SIZE 1000000
declare
cursor obj_cursor (objname Varchar2) is
Select object_name, object_type, owner
from dba_objects
where owner = 'ITA '.
and object_type IN ('TABLE', 'SEE')
and object_name like '% JOB_;

cursor c_job_status is
SELECT ownerid jobid, starttime, endtime
OF ita.tpis32_job_status
WHERE starttime < sysdate - 800
AND num_lines > 10000000;
WK_SQL VARCHAR2 (500);
WK_JOBSTR VARCHAR2 (500);
BEGIN
for c_job loop c_job_status
wk_jobstr: = 'JOB_ | c_job. JobID | '%';
for wk_rec loop obj_cursor (wk_jobstr)
If wk_rec.object_type = "TABLE" then
wk_sql: = 'drop table' |' ITA.' | wk_rec.object_name | ';';
dbms_output.put_line (wk_sql);
end if;
If wk_rec.object_type = "DISPLAY" then
wk_sql: = 'drop view ' | wk_rec.object_name | ';';
dbms_output.put_line (wk_sql);
-Wk_sql EXECUTE IMMEDIATE.
end if;
end loop;
end loop;
end delete_table;
create or replace procedure delete_table is
cursor obj_cursor(objname Varchar2) is
select object_name, object_type, owner
from dba_objects
where owner = 'ITA'
and object_type IN ('TABLE', 'VIEW')
and object_name like 'JOB_%';

cursor c_job_status is
SELECT jobid, ownerid, starttime, endtime
FROM ita.tpis32_job_status
WHERE starttime < sysdate - 800
AND num_lines > 10000000;
WK_SQL VARCHAR2(500);
WK_JOBSTR VARCHAR2(500);
BEGIN
for c_job in c_job_status loop
wk_jobstr := 'JOB_' ||c_job.jobid||'%';
for wk_rec in obj_cursor(wk_jobstr) loop
if wk_rec.object_type = 'TABLE' then
wk_sql := 'drop table ' ||'ita.'|| wk_rec.object_name || ';';
dbms_output.put_line(wk_sql);
end if;
if wk_rec.object_type = 'VIEW' then
wk_sql := 'drop view ' || wk_rec.object_name || ';';
dbms_output.put_line(wk_sql);
--EXECUTE IMMEDIATE wk_sql;
end if;
end loop;
end loop;
end delete_table;

Tags: Database

Similar Questions

  • How to create a stored procedure to delete and create table

    Version: Oracle 10g

    I am trying to create a stored procedure that is delete it and create a table based on a select statement. I can create the table, but I can't let it go.

    CREATE or REPLACE procedure EC_LOAD is
    Start
    INSERT INTO Sales_table
    (FSCL_WK,
    DIV,
    ACCT_TYPE)
    Select
    FSCL_WK,
    DIV,
    ACCT_TYPE
    Of
    sales_revenue;
    end ecload;

    I need to drop the Sales_table before inserting the values. How can I do this?

    user610131 wrote:

    I need to drop the Sales_table before inserting the values. How can I do this?

    If you drop off where you insert it :)? Do you mean DELETE or TRUNCATE?

    If table can be truncated (and don't forget TRUNCATE is DDL then he will commit):

    CREATE OR REPLACE procedure EC_LOAD is
    begin
    EXECUTE IMMEDIATE 'TRUNCATE TABLE Sales_table';
    INSERT INTO Sales_table
    (FSCL_WK,
    DIV,
    ACCT_TYPE)
    Select
    FSCL_WK,
    DIV,
    ACCT_TYPE
    from
    sales_revenue;
    end ecload;
    

    Otherwise, use DELETE:

    CREATE OR REPLACE procedure EC_LOAD is
    begin
    DELETE Sales_table;
    INSERT INTO Sales_table
    (FSCL_WK,
    DIV,
    ACCT_TYPE)
    Select
    FSCL_WK,
    DIV,
    ACCT_TYPE
    from
    sales_revenue;
    end ecload;
    

    SY.

  • Create a stored procedure in the settings view

    I want to be able to create a view with the parameters of a stored procedure.

    Oracle 11g.

    don't know how to use the variable in immediate execution.

    CREATE OR REPLACE

    PROCEDURE TEST_GENERIC (TBL IN VARCHAR2, VWNAME IN VARCHAR2)

    AS

    BEGIN

    RUN IMMEDIATELY "CREATE OR REPLACE VIEW VWNAME AS SELECT SYSDATE FROM TBL";

    COMMIT;

    END;

    exec ('BIRD', 'DUAL') TEST_GENERIC

    Thanks for any help

    Hello

    Single quotes enclose a literal string; in other words, the text between the quotes literally means what it says, without reference to any variables.

    So, when you say:

    RUN IMMEDIATELY "CREATE OR REPLACE VIEW VWNAME AS SELECT SYSDATE FROM TBL";

    CREATE the word literally means to CREATE.  You may or may not have also a variable called CREATE, but that is irrelevant.

    The word OR means OR literally.  You may or may not have also a variable called operation GOLD, but that is irrelevant.

    REPLACE the word literally means REPLACE.  You may or may not have also a variable called to REPLACE, but that is irrelevant.

    ...

    The TBL Word literally means TBL.  You may or may not have also a variable called TBL, but that is irrelevant.

    If you want to reference a variable called TBL, then use TBL outside single quotes, like this:

    ...

    sql_text: = "CREATE or REPLACE VIEW VWNAME AS SELECT SYSDATE FROM '

    ||  TBL;

    dbms_output.put_line (sql_text |) "= sql_text before EXECUTE IMMEDIATE');   -For debugging

    EXECUTE IMMEDIATE sql_text.

    ...

    On the rare occasions when you use dynamic SQL statements, always put the dynamic SQL statement in a string variable (for example, sql_text, above) so that you can easily display for debugging purposes and to ensure that the command you are viewing is the same exact command that you should run.

    I guess the code you posted is a first test version of something that will be much, much different when it is finished.  Creating objects from database (such as views) in PL/SQL is almost always a terrible idea, and it seems that opinion that this code is attempting to produce would be very useful, anyway.

  • Create a stored procedure to convert a temporary table to the current table

    I have a table in oracle, named motor_assist2 with columns:
    NAME
    ADDRESS
    PHONE
    CITY
    STATE
    ZIP
    FRIENDSHIP
    SERVICE
    WAIT_TIME
    CONT_SERVICE
    COMMENTS
    DATETIME
    TECHNICIAN1_RADIO
    TECHNICIAN1_NAME
    LOCATION
    COUNTY_NAME
    COUNTY_ABBR
    MAV_TROOP
    TECHNICIAN2_RADIO
    TECHNICIAN2_NAME
    ID
    BEG_DATE
    END_DATE
    MONTH
    YEAR

    I have an another table (motor_assist9) in excel with similar columns I want to insert this data into my table (motor_assist2) current using a procedure but do not know how to do it. Can someone help me? Thank you

    Deanna

    If the number of columns and the order of the columns match on both tables, you can use:

    insert into motor_assist2 select * from motor_assist9;
    

    If this isn't the case, you will need to specify which columns of the source and/or destination:

    insert into motor_assist2 (destination, column, list)
           select source, column, list from motor_assist9;
    

    To make a wrap just stored as appropriate procedure insert the statement with the following code:

    create or replace procedure procedure_name as
    begin
      
    end;
    /
    
  • Create the stored procedure with the table from another throw diagram PLS-00201

    Oracle 10g. I'm new on procedures, so maybe I'm missing something obvious.

    The ABC schema owner has table T2001_WRITEOFF. The SYSDBAs given SIUD Some_Update_Role and granted this role to developer user IJK. IJK user then created a private synonym T2001_WRITEOFF for ABC. T2001_WRITEOFF. It worked with the usual SQL DML commands.

    When I try to create a simple procedure, it throws PLS-00201 identifier "T2001_WRITEOFF" must be declared and the points of the 2nd line.

    create or replace procedure woof1(
      fooname
    in T2001_WRITEOFF.territory%TYPE,  <=== error points here
      bardesc
    IN T2001_WRITEOFF.ind_batch_submit%TYPE) IS
    BEGIN
      
    INSERT into T2001_WRITEOFF
      
    VALUES ( fooname, bardesc);
    END woof1;
    /


    What I am doing wrong?


    Thank you

    JimR


    Grant the necessary rights directly to the user (not through a role):

    http://asktom.Oracle.com/pls/asktom/asktom.download_file?p_file=6551289900368934430

  • Failed to create the stored procedure with the object as a parameter

    Hello

    No idea how to create procedures to the current data stored in SQLFire, try to run the command prompt "sqlf" per call "create_proc.sql" as give below error below

    C:\SQLFire10Beta>sqlf
    sqlf version 10.4
    sqlf> connect client 'localhost:1527';
    sqlf> run 'create_proc.sql';
    sqlf> CREATE PROCEDURE INSURANCE.SEARCHCUSTOMER (IN CUST OBJECT) DYNAMIC RESULT SETS 1 LANGUAGE JAVA PARAMETER STYLE JAVA READS SQ
    L DATA EXTERNAL NAME com.xxx.xxx.sqlfire.dao.CustomerSearchProcedure.searchCustomer;
    ERROR 42X01: Syntax error: Encountered "" at line 1, column 47.
    Caused by: SqlException: Syntax error: Encountered "" at line 1, column 47.
            at com.vmware.sqlfire.internal.client.am.Statement.completeSqlca(Statement.java:1838)
    sqlf> sqlf> 


    and I created a class Java as described below:

    public class CustomerSearchProcedure {
     
     public static void searchCustomer (BaseDTO[] customers, ResultSet[] outResults,
       ProcedureExecutionContext context) throws SQLException {
      BaseDTO searchCriteria = customers[0];
      StringBuilder sql = new StringBuilder();
      sql.append("SELECT * FROM INSURANCE.CUSTOMERS WHERE CUST_NAME LIKE '"+searchCriteria.getCustName().trim() + "%'");
      
      Connection cxn = context.getConnection();
      Statement stmt = cxn.createStatement();
      ResultSet rs = stmt.executeQuery(sql.toString());
      outResults[0] = rs;
     } //END OF METHOD
    }


    This procedure is called class using the class StoredProcedure Spring DAO

    You can let me know why am not able to create the procedure?

    FYI, pots can also can be dynamically installed in the system by using the SYS. Table client-side JARS to transport the jar bytes rather than by requiring that the pot be accessible side Server (http://pubs.vmware.com/vfabric5/index.jsp?topic=/com.vmware.vfabric.sqlfire.1.0/deploy_guide/Topics/sysjars_install.html)

  • Unable to create the stored procedure batch Oracle Script from Windows

    Hello
    I put my code here please let me know where I have error
    Cmd
    -------
    DNAME SET = %3
    SET UerName = %1
    SET Pssword = %2
    SET Opdir = C:\Users\testuser\
    sqlplus-s '% UerName%/%Pssword%@%DNAME%' @%Opdir%procdure.sql

    procedure. SQL
    --------------
    WHENEVER SQLERROR EXIT SQL. SQLCODE ROLLBACK
    WHENEVER OSERROR EXIT SQL. OSCODE RESTORATION
    SET SERVEROUTPUT ON
    SET ECHO ON
    AUTOPRINT SET ON
    RUN THE DBMS_OUTPUT. ENABLE (1000000)
    COIL Seq.log
    SET linesize 1000
    CREATE PROCEDURE test "()" ""
    AS
    BEGIN
    NULL;
    END test;
    SPOOL OFF
    OUTPUT
    -----------

    Demostrating how I executed


    C:\Users\nikhilgk > otherobj AAA AAA TEST
    C:\Users\nikhilgk > SET DNAME = TEST
    C:\Users\nikhilgk > SET UerName = AAA

    C:\Users\nikhilgk > SET Pssword = AAA

    C:\Users\nikhilgk > SET LOG = C:\Users

    C:\Users\nikhilgk > SET Opdir = C:\Users\testuser\

    C:\Users\nikhilgk > sqlplus s 'AAA/AAA@TEST' @procdure.sql

    PL/SQL procedure successfully completed.

    ------------------------
    Journal is is created with size 0 KB.

    I connected to SQLPLUS and questioned
    SQL > select object_name from user_objects where type_objet = 'PROCEDURE '.

    no selected line.

    you have'nt actually run the code to create procedure.

    create PROCEDURE TEST()
    AS
    BEGIN
    NULL;
    END test;
    /  -- you need this 
    

    also if you want to access without double quotes all the time, do not put double quotes on the name

    And I think you should go out; rather than leave. That's why you have a size zero.

    Published by: Keith Jamieson 31 August 2012 13:21

  • Create a stored procedure or trigger to set a column equal to the other

    Hey guys,.

    I have two columns in a table, and when A column is updated or inserted, I need the database to update automatically the B column (in the same table) is equal to that. I can't create a trigger AFTER INSERT or UPDATE, because it's the same table and it gives me the error of changing tables.

    Any help is appreciated.

    How did you define your trigger? It seems that you should just be able to do

    BEGIN
      :new.columnB := :new.columnA;
    END;
    

    I guess if you get an error table mutation that your trigger is trying to query the table. I do not see a need to query the table.

    Justin

  • Create or replace Stored procedure

    Hi all

    11.2.0.1

    I have the HR schema/user, who is the owner of all tables in the app.

    Then, all his paintings are also granted to BATCH - HR user with corresponding synonyms.

    This batch user will be used by computer operators to run reports of generations.

    For security reasons, they are not allowed to CONNECT to HR, but only to the BATCH - RH.

    My question is, can I create a stored procedure to the BATCH - RH which has only synonymous all tables?

    Or is it a good design to install it on human resources?

    Stored procedures recommend to operate only on base tables?

    Thank you

    Petra k.

    You can use everywhere in PL/SQL or external programs, because synonym is nothing more than a name new/more existing object; i.e. scott.emp table can have synonym1, synonym2, synonym3, etc.

    For more information: CREATE SYNONYM

    Concerning

    Girish Sharma

  • ADF view object and stored procedure

    Hi all

    I am facing a problem with the view object, the case is, I created a stored procedure with an input and an output parameter

    view object I need to call this procedure inside the request object view and define the attribute transient output parameter

    could you please help me in this case, please give an example

    Thanks in advance

    Mohamed,

    Can you explain your use case to help you.

    Is it possible to convert the stored procedure in function (and change the output parameter to return the parameters) and create a display object using the function.

    Ex: Create a display object "read access only via the SQL query" for the query: SELECT HR. PLSQLTEST2 staff (first_name) OF

    K

  • Need to query in a stored procedure

    Hi all

    I need to create a stored procedure that does not take any parameter, it's simply an SP which only made the update.

    I update two tables here twice, I update the tables matched_news and matched_news_industries under certain conditions.

    I update two tables twice and after two update tables once, I need to update another table is gm_sector_activity_tracker table, in this update that I need
    update of is_transfered = 'Y' where is_transfered = "M" but I need to update only the rows that are updated in above two updates.

    It means assume that my above two updated day to day only 4 rows, so I need to update the records in the gm_sector_activity_tracker table.

    Here's the code for MS:

    CREATE OR REPLACE PROCEDURE SI_UPDATE_SOURCES_LOGO_PDF AS

    BEGIN

    update of matched_news one

    Set logo_source = (select distinct source_logo from news_sources

    where channel_id = a.channel_id

    and a.newS_id in (select news_id was in gm_sector_activity_tracker where is_transferred = am')

    and 'a.newS_type =' Reports

    and a.LOGO_SOURCE is null

    and a.channel_id not in (6522,6835,6944,6945,6946,7189,8396,8397,8398,5395,9176,9177));

    COMMIT;

    update of matched_news_industries one

    Set logo_source = (select distinct source_logo from news_sources

    where channel_id = a.channel_id

    and a.newS_id in (select news_id was in gm_sector_activity_tracker where is_transferred = am')

    and 'a.newS_type =' Reports

    and a.LOGO_SOURCE is null

    and a.channel_id not in (6522,6835,6944,6945,6946,7189,8396,8397,8398,5395,9176,9177));

    COMMIT;

    / * Once this is done, we need to update the table "gm_sector_activity_tracker" column is_transferred = 'Y' where is_transferred = am' one by one.* /

    Matched_News update

    source_name = value (select distinct (ltrim (rtrim (source_name))) of channel_source_type)

    WHERE CHANNEL_ID = A.CHANNEL_ID

    and ONTO_ID = a.ONTO_ID

    and a.channel_id not in (6522,6835,6944,6945,6946,7189,8396,8397,8398,5395,9176,9177)

    and 'a.news_type =' Reports

    and a.auto_status = 'Categorized'

    and a.news_id in (select news_id was in gm_sector_activity_tracker where is_transferred = am'))

    where exists (select channel_source_type source_name

    where channel_id = a.channel_id

    and ONTO_ID = a.ONTO_ID

    and a.channel_id not in (6522,6835,6944,6945,6946,7189,8396,8397,8398,5395,9176,9177)

    and 'a.news_type =' Reports

    and a.auto_status = 'Categorized'

    and a.news_id in (select news_id was in gm_sector_activity_tracker where is_transferred = am'));

    COMMIT;

    Update matched_news_industries has

    source_name = value (select distinct (ltrim (rtrim (source_name))) of channel_source_type)

    WHERE CHANNEL_ID = A.CHANNEL_ID

    and ONTO_ID = a.ONTO_ID

    and a.channel_id not in (6522,6835,6944,6945,6946,7189,8396,8397,8398,5395,9176,9177)

    and 'a.news_type =' Reports

    and a.auto_status = 'Categorized'

    and a.news_id in (select news_id was in gm_sector_activity_tracker where is_transferred = am'))

    where exists (select channel_source_type source_name

    where channel_id = a.channel_id

    and ONTO_ID = a.ONTO_ID

    and a.channel_id not in (6522,6835,6944,6945,6946,7189,8396,8397,8398,5395,9176,9177)

    and 'a.news_type =' Reports

    and a.auto_status = 'Categorized'

    and a.news_id in (select news_id was in gm_sector_activity_tracker where is_transferred = am'));

    COMMIT;

    / * Once this is done, we need to update the table "gm_sector_activity_tracker" column is_transferred = 'Y' where is_transferred = am' one by one.*.

    END SI_UPDATE_SOURCES_LOGO_PDF;

    Thank you


    Your instructions to update, it's what you do:

    MERGE INTO MATCHED_NEWS HAS

    WITH THE HELP OF NEWS_SOURCES B

    WE (A.CHANNEL_ID = B.CHANNEL_ID)

    WHEN MATCHED THEN

    UPDATE

    SET A.LOGO_SOURCE = B.SOURCE_LOGO

    WHERE A.NEWS_ID IN (NEWS_ID HAS SELECTION SUMMER)

    OF GM_SECTOR_ACTIVITY_TRACKER

    WHERE IS_TRANSFERRED = AM')

    AND A.NEWS_TYPE = 'reports '.

    AND A.LOGO_SOURCE IS NULL

    AND A.CHANNEL_ID NOT IN (6522,

    6835,

    6944,

    6945,

    6946,

    7189,

    8396,

    8397,

    8398,

    5395,

    9176,

    9177);

    You can do the same for the other tables as separate MERGE one after the other.

  • Join vs stored procedure using Decode

    We have a huge table lines and I noticed that the data architect has incorporated a descriptor column extend the length of line so that violate the rules of normalization.

    Given that the column descriptor is not accessible often (with the exception of reports), I propose to eliminate and replace it with a separate table to reach via FK in the big picture.

    There are less than 100 entries in the reference table.

    I see an advantage by creating a stored procedure that returns the descriptor based on the passed key?

    Or is smart enough to perform a join that is essentially as effective as this approach in Oracle memory?

    Yes, there are relevant reasons

  • Error of insufficient privileges on the creation of model running in a stored procedure

    Hello

    I get the error of insufficient privileges on execution of the DBMS_DATA_MINING. Script CREATE_MODEL in a stored procedure.

    If I run the same DBMS_DATA_MINING. Script CREATE_MODEL in an anonymous block with just begin... end;

    I am able to create a model successfully, but if I do the same thing after having stored the script in the stored procedure, it is throwing error of insufficient privileges.

    Scripts:

    BEGIN

    DBMS_DATA_MINING. () CREATE_MODEL

    Model_name = > < template name >

    mining_function = > dbms_data_mining. CLASSIFICATION,

    DATA_TABLE_NAME = > < data table name >

    CASE_ID_COLUMN_NAME = > < case ID >

    target_column_name = > < target column >

    SETTINGS_TABLE_NAME = > < settings table >

    DATA_SCHEMA_NAME = > < schema >

    SETTINGS_SCHEMA_NAME = > < schema >

    );

    END;

    The foregoing, works very well and created a model with the model given with success.

    But if I keep the above, in a stored procedure as - MINING_TESTING

    create or replace procedure MINING_TESTING as

    BEGIN

    DBMS_DATA_MINING. () CREATE_MODEL

    Model_name = > < template name >

    mining_function = > dbms_data_mining. CLASSIFICATION,

    DATA_TABLE_NAME = > < data table name >

    CASE_ID_COLUMN_NAME = > < case ID >

    target_column_name = > < target column >

    SETTINGS_TABLE_NAME = > < settings table >

    DATA_SCHEMA_NAME = > < schema >

    SETTINGS_SCHEMA_NAME = > < schema >

    );

    END;

    Compiles correctly.

    Enforcement - EXEC MINING_TESTING;

    Error message throw sufficient privileges.

    The error message complete below:

    Error report:

    ORA-01031: insufficient privileges

    ORA-06512: at "SYS." DBMS_DATA_MINING', line 1798

    ORA-06512: at "MIS_ORABI_ODM.CA_MINING_TESTER", line 3

    ORA-06512: at line 1

    01031 00000 - "insufficient privileges".

    * Cause: An attempt was made to change the user name or password

    without the privilege appropriate. This error also occurs if

    trying to install a database without the need for employment

    access privileges.

    When Trusted Oracle is configure in DBMS MAC, this error may occur

    If the user has been granted the privilege necessary for a higher label

    that the connection is active.

    * Action: Ask the database to perform the operation or grant administrator

    the required privileges.

    For users Trusted Oracle get this error, well that granted the

    the privilege that is suitable for the top label, ask the database

    administrator to grant the privilege to the appropriate label.

    Hello

    DataMiner UI grants privileges to a role, so if you're depending on these privileges you must proceed as follows when you create a stored procedure.

    Your stored procedure was created with the default authid which is definers. It will not use the privileges for the role. Solution is to create the stored procedure with authid current_user. This will pick up the privileges for the role. Another option is to apply the following subsidies directly to the user account:

    grant CREATE MINING MODEL

    CREATE THE TABLE,

    IN ORDER TO CREATE

    Example of stored procedure:

    create or replace procedure MINING_TESTING AUTHID CURRENT_USER as

    BEGIN

    DBMS_DATA_MINING. () CREATE_MODEL

    MODEL_NAME =>

    mining_function-online dbms_data_mining. CLASSIFICATION,

    DATA_TABLE_NAME =>

    CASE_ID_COLUMN_NAME =>

    target_column_name =>

    SETTINGS_TABLE_NAME =>

    DATA_SCHEMA_NAME =>

    SETTINGS_SCHEMA_NAME =>

    );

    END;

    Thank you, Mark

  • Use the utilities from the Oracle stored procedure

    Hi all

    I use Oracle Import to load the data from .dmp file to Oracle table.

    Test/test leader IMP = Data .dmp fromuser = user1 touser = test tables = emp

    But my requirement is to create a stored procedure that will import data into the table and identify the number of loaded records and how impossible to import.

    Can I keep inside the procedure import statement?

    Thank you.

    No, not possible.

    IMP is an exe like sql more who can evoke to the command prompt.

    If you need all the actions on the imported... table export for example/test table, and then go further.

  • 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

Maybe you are looking for

  • I can't create a new project of film since 10.1.2 update.

    I can't create a new project of film since 10.1.2 update. The 'Project' tab if I select "new project_film", nothing happens. Creating a factory trailer...

  • loads of my facebook but indicates that the toolbar.

    I have the white screen of gat e when I load up facebook, but only on my laptop. The toolbars are at the top, but everything else is empty. I can access it with the log https on but then when I click on a link or my profile, I just get the same blank

  • My Panorama button is missing and Ctrl + E is ignored. 4.0B10

    By the subject line. Before my last reboot of the system, the Panorama was very good. The feature is now gone - as well as of all tabs open, represented by the other groups of Panorama I had! I barely noticed the change, but maybe it happened earlier

  • Need drivers for my Portege Dynabook SS 10 L/2 1600

    Hello.. I am beginner. I'm from the Indonesia. Where is the drivers for my Portege Dynabook SS 10 L/2 1600? Because there is none on the download page. I need to download, is that I really, really need to do a fresh install and my recovery disk is lo

  • Change your empty keyboard security

    The keyboard on a T420 eliminated easily by removing the 2 screws under the laptop: to open the memory/PCIe compartment, the other to remove the keyboard itself. It is: to change the keyboard will void you the warranty on the computer laptop everythi