Procedure to run pubs block

Hi all.
I need to execute the pl/sql procedure to run pubs block.
I'm doing it with exec but in error:

Start
RUN IMMEDIATELY.
exec FillTestForOperation';
end;
/

Start
*
ERROR on line 1:
ORA-00900: invalid SQL statement
ORA-06512: at line 2

Is it possible to do?
begin
  EXECUTE IMMEDIATE 'begin FillTestForOperation; end';
end;

or why not simply...

begin
  FillTestForOperation;
end;

Tags: Database

Similar Questions

  • In plsql block that will run first block internal or external block...

    In plsql block that will run first block internal or external block...

    pls help...

    Outer block starts running first.
    Inner block full execution first.

    Suresh.

  • Reg: Mailing 'time of procedure then run ".

    Hi all

    I created a PL/SQL procedure that will send e-mail about password expiration of oracle user details.

    Here's my script

    declare
    crlf VARCHAR2(2)  := chr(13)||chr(10);
    CURSOR c1 IS SELECT 
    e.alternate_name,e.email,e.cc,u.expiry_date, round(u.expiry_date-sysdate) as date_diff 
    FROM dba_users u, email_address e 
    WHERE u.username=e.username;
    username VARCHAR2(50); 
    email VARCHAR2(250);
    expire_date varchar2(50);
    date_diff  varchar2(50);
    sender VARCHAR2(40) := '[email protected]';  
    message VARCHAR2(200);
    final_message varchar2(1000);
    mailhost VARCHAR2(30) := 'x.x.x.x';  
    mail_conn UTL_SMTP.connection; 
    BEGIN 
    message:=' user will expire in ';  
    OPEN c1; 
    LOOP 
    FETCH c1 INTO username,email,expire_date,date_diff; 
    EXIT WHEN c1%NOTFOUND;  
       final_message := final_message || 'user: '|| username ||')' || crlf || 'Password of ' || username||message||' '||date_diff||'days'||' (Expiry Date: ' || expire_date || '): ';
    END LOOP; 
    CLOSE c1;
    mail_conn := UTL_SMTP.open_connection(mailhost, 25); 
    UTL_SMTP.helo(mail_conn, mailhost);
    UTL_SMTP.mail(mail_conn, sender); 
    UTL_SMTP.rcpt(mail_conn, email);
    UTL_SMTP.DATA(mail_conn, 'To: ' || email || crlf || 'Subject: ' || '[Test Mail]: Oracle User Password Expiry Reminder('||final_message||')';
    UTL_SMTP.quit(mail_conn);
    END;
    /
    
    
    

    I have planned the procedure above using DBMS_SCHEDULER

    Schedule: Fridays at 10:00

    When I run the above procedure, I will get an email about the oracle user password expiration information.

    But I want to add the next execution of the procedure in the same mail by querying dba_scheduler_jobs.

    I could do this using nested cursors, but I get execution instead of the next pending execution date.

    Is it possible to get the next execution date of the method, either by pulling the trigger, either within the procedure that precedes itself?

    REF-> previous discussion: https://forums.oracle.com/thread/2612449

    Hi Madhu,

    Please check DBMS_SCHEDULER. EVALUATE_CALENDAR_STRING.

    http://docs.Oracle.com/CD/E11882_01/AppDev.112/e25788/d_sched.htm#ARPLS72367

    Example link above...

    > set SERVEROUTPUT ON

    > ALTER SESSION set NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS.

    session the changed VALUE.

    > DECLARE

    start_date TIMESTAMP;

    return_date_after TIMESTAMP;

    next_run_date TIMESTAMP;

    BEGIN

    start_date: =.

    TO_TIMESTAMP_TZ (sysdate, 'DD-MON-YYYY HH24:MI:SS');

    return_date_after: = start_date;

    FOR I IN 1.5 LOOP

    DBMS_SCHEDULER. () EVALUATE_CALENDAR_STRING

    "FREQ = ALL DAYS; BYHOUR = 9; BYMINUTE = 30; BYDAY = MON, FRI, MAR, SEA, GAME '.

    start_date, return_date_after, next_run_date);

    DBMS_OUTPUT. Put_line ('next_run_date: ' | next_run_date);

    return_date_after: = next_run_date;

    END LOOP;

    END;

    anonymous block filled

    next_run_date: December 16, 13 09.30.44.000000 AM

    next_run_date: 17 December 13 09.30.44.000000 AM

    next_run_date: December 18, 13 09.30.44.000000 AM

    next_run_date: December 19, 13 09.30.44.000000 AM

    next_run_date: 20 December 13 09.30.44.000000 AM

    I hope this helps.

    VR,

    Sudhakar

  • Currently running MRT blocks the Taskman.exe or ACPIEC.sys computer.

    original title: when I run the MRT, it blocks the computer the Taskman.exe or ACPIEC.sys. I'm just left with a black screen and have to restart.

    When I run the MRT, it blocks the computer the Taskman.exe or ACPIEC.sys. I'm just left with a black screen and have to restart. Any ideas? Using Windows XP

    Hello

    I suggest you to download and run the latest Microsoft security on your computer Scanner and check if it helps:

    http://www.Microsoft.com/security/scanner/en-us/default.aspx

    Note: The data files that are infected must be cleaned only by removing the file completely, which means that there is a risk of data loss.

  • Creating a PL/SQL procedure to run the following code but the landing upwards errors!

    Hey all!

    This is my first time with PL/SQL. I created the following procedure to load a major part of the update instructions at the same time to read the DB performance. I need to print a sysdate timestamp before and after the load so that I can know how long it takes for the DB update prescribed lines. I gave 100 lines initially and will keep changing. When I run this code, I came across some errors. Could you please help me with it.

    CODE:

    PROCEDURE FACT_UPDATE
    IS
    DECLARE
    CNT NUMBER: = 0;

    UPD CURSOR is
    SELECT
    'UPDATE XXAFL_MON_FACTS_F SET TASK_WID =' | NVL (TO_CHAR (TASK_WID), 'NULL') |', EXECUTION_PLAN_WID =' | NVL (TO_CHAR (EXECUTION_PLAN_WID), 'NULL').
    ', DETAILS_WID =' | NVL (TO_CHAR (DETAILS_WID), 'NULL') |', SOURCE_WID =' | NVL (TO_CHAR (SOURCE_WID), 'NULL') |', TARGET_WID = ' | NVL (TO_CHAR (TARGET_WID), 'NULL').
    ', RUN_STATUS_WID =' | NVL (TO_CHAR (RUN_STATUS_WID), 'NULL') |', SEQ_NUM =' | NVL (TO_CHAR (SEQ_NUM), 'NULL') |', NAME = "' | NVL (TO_CHAR (NAME), 'NULL').
    "', NO_POSITION =" ' | NVL (TO_CHAR (INSTANCE_NUM), e ') | " ', INSTANCE_NAME = "' | NVL (TO_CHAR (INSTANCE_NAME), 'NULL').
    "', TYPE_CD =" ' | NVL (TO_CHAR (TYPE_CD), e ') | " ', STATUS_CD = "' | NVL (TO_CHAR (STATUS_CD), e ') | " ', START_TS =' | Decode (START_TS, null, "to_date('''|| to_char (START_TS,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")').
    ', END_TS =' | Decode (END_TS, null, "to_date('''|| to_char (END_TS,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")') |', DURATION = ' | NVL (TO_CHAR (DURATION), 'NULL') |', STATUS_DESC = "' | NVL (TO_CHAR (STATUS_DESC), 'NULL').
    "', DBCONN_NAME =" ' | NVL (TO_CHAR (DBCONN_NAME), e ') | " ', SUCESS_ROWS =' | NVL (TO_CHAR (SUCESS_ROWS), 'NULL').
    ', FAILED_ROWS =' | NVL (TO_CHAR (FAILED_ROWS), 'NULL') |', ERROR_CODE = ' | NVL (TO_CHAR (ERROR_CODE), 'NULL') |', NUM_RETRIES =' | NVL (TO_CHAR (NUM_RETRIES), 'NULL').
    ', READ_THRUPUT =' | NVL (TO_CHAR (READ_THRUPUT), 'NULL') |', LAST_UPD = ' | Decode (LAST_UPD, null, "to_date('''|| to_char (LAST_UPD,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")') |', RUN_STEP_WID = "' | NVL (TO_CHAR (RUN_STEP_WID), 'NULL').
    "', W_INSERT_DT = ' | Decode (W_INSERT_DT, null, "to_date('''|| to_char (W_INSERT_DT,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")') |', W_UPDATE_DT = ' | Decode (W_UPDATE_DT, null, "to_date('''|| to_char (W_UPDATE_DT,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")').
    ', START_DATE_WID =' | NVL (TO_CHAR (START_DATE_WID), 'NULL') |', END_DATE_WID = ' | NVL (TO_CHAR (END_DATE_WID), 'NULL') |', START_TIME =' |
    NVL (TO_CHAR (START_TIME), 'NULL') |', END_TIME =' | NVL (TO_CHAR (END_TIME), 'NULL'). "WHERE INTEGRATION_ID ="' | INTEGRATION_ID | " « ; » AS a Column OF XXAFL_MON_FACTS_F;

    BEGIN
    dbms_output.put_line (sysdate);
    to record in a loop of the UPD

    dbms_output.put_line (record.col_name);
    immediately run record.col_name;

    CNT: = cnt + 1;
    If cnt > 1000
    and then commit;
    CNT: = 0;
    dbms_output.put_line (sysdate);
    end if;
    end loop;
    dbms_output.put_line (sysdate);


    END; -Procedure

    ERRORS:

    Error starting line: 1 at the controls.
    PROCEDURE FACT_UPDATE
    Error report-
    Unknown command

    Error from line: 2 in command.
    IS
    Error report-
    Unknown command
    Error from line: 3 in command.
    DECLARE
    CNT: = 0;

    UPD CURSOR is
    SELECT
    'UPDATE XXAFL_MON_FACTS_F SET TASK_WID =' | NVL (TO_CHAR (TASK_WID), 'NULL') |', EXECUTION_PLAN_WID =' | NVL (TO_CHAR (EXECUTION_PLAN_WID), 'NULL').
    ', DETAILS_WID =' | NVL (TO_CHAR (DETAILS_WID), 'NULL') |', SOURCE_WID =' | NVL (TO_CHAR (SOURCE_WID), 'NULL') |', TARGET_WID = ' | NVL (TO_CHAR (TARGET_WID), 'NULL').
    ', RUN_STATUS_WID =' | NVL (TO_CHAR (RUN_STATUS_WID), 'NULL') |', SEQ_NUM =' | NVL (TO_CHAR (SEQ_NUM), 'NULL') |', NAME = "' | NVL (TO_CHAR (NAME), 'NULL').
    "', NO_POSITION =" ' | NVL (TO_CHAR (INSTANCE_NUM), e ') | " ', INSTANCE_NAME = "' | NVL (TO_CHAR (INSTANCE_NAME), 'NULL').
    "', TYPE_CD =" ' | NVL (TO_CHAR (TYPE_CD), e ') | " ', STATUS_CD = "' | NVL (TO_CHAR (STATUS_CD), e ') | " ', START_TS =' | Decode (START_TS, null, "to_date('''|| to_char (START_TS,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")').
    ', END_TS =' | Decode (END_TS, null, "to_date('''|| to_char (END_TS,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")') |', DURATION = ' | NVL (TO_CHAR (DURATION), 'NULL') |', STATUS_DESC = "' | NVL (TO_CHAR (STATUS_DESC), 'NULL').
    "', DBCONN_NAME =" ' | NVL (TO_CHAR (DBCONN_NAME), e ') | " ', SUCESS_ROWS =' | NVL (TO_CHAR (SUCESS_ROWS), 'NULL').
    ', FAILED_ROWS =' | NVL (TO_CHAR (FAILED_ROWS), 'NULL') |', ERROR_CODE = ' | NVL (TO_CHAR (ERROR_CODE), 'NULL') |', NUM_RETRIES =' | NVL (TO_CHAR (NUM_RETRIES), 'NULL').
    ', READ_THRUPUT =' | NVL (TO_CHAR (READ_THRUPUT), 'NULL') |', LAST_UPD = ' | Decode (LAST_UPD, null, "to_date('''|| to_char (LAST_UPD,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")') |', RUN_STEP_WID = "' | NVL (TO_CHAR (RUN_STEP_WID), 'NULL').
    "', W_INSERT_DT = ' | Decode (W_INSERT_DT, null, "to_date('''|| to_char (W_INSERT_DT,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")') |', W_UPDATE_DT = ' | Decode (W_UPDATE_DT, null, "to_date('''|| to_char (W_UPDATE_DT,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")').
    ', START_DATE_WID =' | NVL (TO_CHAR (START_DATE_WID), 'NULL') |', END_DATE_WID = ' | NVL (TO_CHAR (END_DATE_WID), 'NULL') |', START_TIME =' |
    NVL (TO_CHAR (START_TIME), 'NULL') |', END_TIME =' | NVL (TO_CHAR (END_TIME), 'NULL'). "WHERE INTEGRATION_ID ="' | INTEGRATION_ID | " « ; » AS a Column OF XXAFL_MON_FACTS_F;

    BEGIN
    dbms_output.put_line (sysdate);
    to record in a loop of the UPD

    dbms_output.put_line (record.col_name);
    immediately run record.col_name;

    CNT: = cnt + 1;
    If cnt > 1000
    and then commit;
    CNT: = 0;
    dbms_output.put_line (sysdate);
    end if;
    end loop;
    dbms_output.put_line (sysdate);


    END; -Procedure
    Error report-
    ORA-06550: line 2, column 6:
    PLS-00103: encountered the symbol "=" when expecting one of the following conditions:

    constant exception < an ID >
    < a between double quote delimited identifiers > double long Ref table
    char time timestamp interval date binary national character
    NCHAR
    The symbol '< identifier >' has been substituted for "=" continue.
    06550 00000 - "line %s, column % s:\n%s".
    * Cause: Usually a PL/SQL compilation error.
    * Action:
    Error starting line: 1 at the controls.
    PROCEDURE FACT_UPDATE
    Error report-
    Unknown command

    Error from line: 2 in command.
    IS
    Error report-
    Unknown command
    Error from line: 3 in command.
    DECLARE
    CNT NUMBER: = 0;

    UPD CURSOR is
    SELECT
    'UPDATE XXAFL_MON_FACTS_F SET TASK_WID =' | NVL (TO_CHAR (TASK_WID), 'NULL') |', EXECUTION_PLAN_WID =' | NVL (TO_CHAR (EXECUTION_PLAN_WID), 'NULL').
    ', DETAILS_WID =' | NVL (TO_CHAR (DETAILS_WID), 'NULL') |', SOURCE_WID =' | NVL (TO_CHAR (SOURCE_WID), 'NULL') |', TARGET_WID = ' | NVL (TO_CHAR (TARGET_WID), 'NULL').
    ', RUN_STATUS_WID =' | NVL (TO_CHAR (RUN_STATUS_WID), 'NULL') |', SEQ_NUM =' | NVL (TO_CHAR (SEQ_NUM), 'NULL') |', NAME = "' | NVL (TO_CHAR (NAME), 'NULL').
    "', NO_POSITION =" ' | NVL (TO_CHAR (INSTANCE_NUM), e ') | " ', INSTANCE_NAME = "' | NVL (TO_CHAR (INSTANCE_NAME), 'NULL').
    "', TYPE_CD =" ' | NVL (TO_CHAR (TYPE_CD), e ') | " ', STATUS_CD = "' | NVL (TO_CHAR (STATUS_CD), e ') | " ', START_TS =' | Decode (START_TS, null, "to_date('''|| to_char (START_TS,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")').
    ', END_TS =' | Decode (END_TS, null, "to_date('''|| to_char (END_TS,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")') |', DURATION = ' | NVL (TO_CHAR (DURATION), 'NULL') |', STATUS_DESC = "' | NVL (TO_CHAR (STATUS_DESC), 'NULL').
    "', DBCONN_NAME =" ' | NVL (TO_CHAR (DBCONN_NAME), e ') | " ', SUCESS_ROWS =' | NVL (TO_CHAR (SUCESS_ROWS), 'NULL').
    ', FAILED_ROWS =' | NVL (TO_CHAR (FAILED_ROWS), 'NULL') |', ERROR_CODE = ' | NVL (TO_CHAR (ERROR_CODE), 'NULL') |', NUM_RETRIES =' | NVL (TO_CHAR (NUM_RETRIES), 'NULL').
    ', READ_THRUPUT =' | NVL (TO_CHAR (READ_THRUPUT), 'NULL') |', LAST_UPD = ' | Decode (LAST_UPD, null, "to_date('''|| to_char (LAST_UPD,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")') |', RUN_STEP_WID = "' | NVL (TO_CHAR (RUN_STEP_WID), 'NULL').
    "', W_INSERT_DT = ' | Decode (W_INSERT_DT, null, "to_date('''|| to_char (W_INSERT_DT,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")') |', W_UPDATE_DT = ' | Decode (W_UPDATE_DT, null, "to_date('''|| to_char (W_UPDATE_DT,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")').
    ', START_DATE_WID =' | NVL (TO_CHAR (START_DATE_WID), 'NULL') |', END_DATE_WID = ' | NVL (TO_CHAR (END_DATE_WID), 'NULL') |', START_TIME =' |
    NVL (TO_CHAR (START_TIME), 'NULL') |', END_TIME =' | NVL (TO_CHAR (END_TIME), 'NULL'). "WHERE INTEGRATION_ID ="' | INTEGRATION_ID | " « ; » AS a Column OF XXAFL_MON_FACTS_F;

    BEGIN
    dbms_output.put_line (sysdate);
    to record in a loop of the UPD

    dbms_output.put_line (record.col_name);
    immediately run record.col_name;

    CNT: = cnt + 1;
    If cnt > 1000
    and then commit;
    CNT: = 0;
    dbms_output.put_line (sysdate);
    end if;
    end loop;
    dbms_output.put_line (sysdate);


    END; -Procedure
    Error report-
    ORA-00911: invalid character
    ORA-06512: at line 24
    00911 00000 - "invalid character".
    * Cause: identifiers may not start with any character other than ASCII
    letters and numbers.  $# _ are allowed after the first
    character.  May contain identifiers surrounded by doublequotes
    any character other than a quotation mark.  Other quotes
    (q' #... #') cannot use spaces, tabs or as carriage returns
    delimiters.  For all other settings, consult the SQL language
    Reference manual.
    * Action:

    In addition to the other reviews, and apart from the quality of the code, you should really (really!) learn how to format your code for better "read-ability.  This will also contribute to a better quality.  If you are unsure how to format, then use a development as a SQL developer tool.  It will not format "as you type", but a frequent use of the shortened format keyboard (Ctrl + F7 in SQL Dev) will keep your code readable and coherent.

    And then you learn to keep this format when you post on the forum.

    Like this:

    PROCEDURE FACT_UPDATE

    IS

    DECLARE

    CNT NUMBER: = 0;

    CURSOR UPD

    IS

    SELECT "UPDATE XXAFL_MON_FACTS_F SET TASK_WID ='"

    || NVL (TO_CHAR (TASK_WID), 'NULL')

    |', EXECUTION_PLAN_WID ='

    || NVL (TO_CHAR (EXECUTION_PLAN_WID), 'NULL')

    || ', DETAILS_WID ='

    || NVL (TO_CHAR (DETAILS_WID), 'NULL')

    |', SOURCE_WID ='

    || NVL (TO_CHAR (SOURCE_WID), 'NULL')

    |', TARGET_WID = '

    || NVL (TO_CHAR (TARGET_WID), 'NULL')

    || ', RUN_STATUS_WID ='

    || NVL (TO_CHAR (RUN_STATUS_WID), 'NULL')

    |', SEQ_NUM ='

    || NVL (TO_CHAR (SEQ_NUM), 'NULL')

    |', NAME = "'

    || NVL (TO_CHAR (NAME), 'NULL')

    || ' ', NO_POSITION = "'

    || NVL (TO_CHAR (INSTANCE_NUM), 'NULL')

    ||'' ', INSTANCE_NAME = "'

    || NVL (TO_CHAR (INSTANCE_NAME), 'NULL')

    || ' ', TYPE_CD = "'

    || NVL (TO_CHAR (TYPE_CD), 'NULL')

    ||'' ', STATUS_CD = "'

    || NVL (TO_CHAR (STATUS_CD), 'NULL')

    ||'' ', START_TS ='

    || DECODE (START_TS, ",' to_date(''e))

    || To_char (START_TS, "mm/dd/yyyy hh)

    ||'' ((', "dd/mm/yyyy hh")')

    || ', END_TS ='

    || DECODE (END_TS, ",' to_date(''e))

    || To_char (END_TS, "mm/dd/yyyy hh)

    ||'' ((', "dd/mm/yyyy hh")')

    |', DURATION = '

    || NVL (TO_CHAR (DURATION), 'NULL')

    |', STATUS_DESC = "'

    || NVL (TO_CHAR (STATUS_DESC), 'NULL')

    || ' ', DBCONN_NAME = "'

    || NVL (TO_CHAR (DBCONN_NAME), 'NULL')

    ||'' ', SUCESS_ROWS ='

    || NVL (TO_CHAR (SUCESS_ROWS), 'NULL')

    || ', FAILED_ROWS ='

    || NVL (TO_CHAR (FAILED_ROWS), 'NULL')

    |', ERROR_CODE = '

    || NVL (TO_CHAR (ERROR_CODE), 'NULL')

    |', NUM_RETRIES ='

    || NVL (TO_CHAR (NUM_RETRIES), 'NULL')

    || ', READ_THRUPUT ='

    || NVL (TO_CHAR (READ_THRUPUT), 'NULL')

    |', LAST_UPD = '

    || DECODE (LAST_UPD, ",' to_date(''e))

    || To_char (LAST_UPD, "mm/dd/yyyy hh)

    ||'' ((', "dd/mm/yyyy hh")')

    |', RUN_STEP_WID = "'

    || NVL (TO_CHAR (RUN_STEP_WID), 'NULL')

    || ' ', W_INSERT_DT = '

    || DECODE (W_INSERT_DT, ",' to_date(''e))

    || To_char (W_INSERT_DT, "mm/dd/yyyy hh)

    ||'' ((', "dd/mm/yyyy hh")')

    |', W_UPDATE_DT = '

    || DECODE (W_UPDATE_DT, ",' to_date(''e))

    || To_char (W_UPDATE_DT, "mm/dd/yyyy hh)

    ||'' ((', "dd/mm/yyyy hh")')

    || ', START_DATE_WID ='

    || NVL (TO_CHAR (START_DATE_WID), 'NULL')

    |', END_DATE_WID = '

    || NVL (TO_CHAR (END_DATE_WID), 'NULL')

    |', START_TIME ='

    || NVL (TO_CHAR (START_TIME), 'NULL')

    |', END_TIME ='

    || NVL (TO_CHAR (END_TIME), 'NULL')

    ||' WHERE INTEGRATION_ID = "'

    || INTEGRATION_ID

    ||''';' AS Column

    OF XXAFL_MON_FACTS_F;

    BEGIN

    dbms_output.put_line (sysdate);

    FOR registration in UPD

    LOOP

    dbms_output.put_line (record.col_name);

    EXECUTE immediate record.col_name;

    CNT: = cnt + 1;

    IF cnt > 1000 THEN

    COMMIT;

    CNT: = 0;

    dbms_output.put_line (sysdate);

    END IF;

    END LOOP;

    dbms_output.put_line (sysdate);

    END; -Procedure

  • PL/SQL procedure to run an ODI load plan via the web service

    Someone at - it a procedure from PL/SQL to run a load of ODI Plan using a web service?

    These discussions helped:

    Run a scenario ODI of APEX

    Problems with UTL_HTTP and problems of access to the network

  • procedure to run the dynamic DDL

    If I have the T table below, and I need to create partitions based on the year (year), but I need to create partitions for each quarter of the year. How can I write a procedure for this?

    WITH T AS 
    (SELECT 2001 YR FROM DUAL
    UNION ALL SELECT 2002 YR FROM DUAL
    )
    select * From t;
    

    Here is what I have run under the procedure:

    ALTER TABLE T ADD PARTITION (PARTITION P2001_01 VALUES LESS THAN (TO_DATE('2001-01-01', 'YYYY-MM-DD' ));
    ALTER TABLE T ADD PARTITION (PARTITION P2001_02 VALUES LESS THAN (TO_DATE('2001-04-01', 'YYYY-MM-DD' ));
    ALTER TABLE T ADD PARTITION (PARTITION P2001_03 VALUES LESS THAN (TO_DATE('2001-07-01', 'YYYY-MM-DD' ));
    ALTER TABLE T ADD PARTITION (PARTITION P2001_04 VALUES LESS THAN (TO_DATE('2001-10-01', 'YYYY-MM-DD' ));
    
    ALTER TABLE T ADD PARTITION (PARTITION P2002_01 VALUES LESS THAN (TO_DATE('2002-01-01', 'YYYY-MM-DD' ));
    ALTER TABLE T ADD PARTITION (PARTITION P2002_02 VALUES LESS THAN (TO_DATE('2002-04-01', 'YYYY-MM-DD' ));
    ALTER TABLE T ADD PARTITION (PARTITION P2002_03 VALUES LESS THAN (TO_DATE('2002-07-01', 'YYYY-MM-DD' ));
    ALTER TABLE T ADD PARTITION (PARTITION P2002_04 VALUES LESS THAN (TO_DATE('2002-10-01', 'YYYY-MM-DD' ));
    

    What I'm missing here?

    You are 'away' the part where you follow the best practices for the development of pl/sql code that contains dynamic queries:

    1. remove the 'run '.

    2 create the query in a string variable

    3. just to "evacuate" the query as a string

    4. run the query manually to validate one) he did know the correct syntax (yours does not), b) it creates the correct result set and c) it works as expected.

    5. Add the "run" and delete the lines DBMS_OUT.

    If you run this procedure you can easily see what is the problem

    I'm in (SELECT "ALTER TABLE TABLE1 add PARTITION (PARTITION P_' |)") Y.YYYY | '_Q' || Q.Q | ' VALUES LESS (TO_DATE(''' ||). Y.YYYY | '-' || Q.M | '-01''' || ',''' || "(YYYY-MM-DD"' | '))'. XYZ

    FROM (SELECT DISTINCT (TO_CHAR (dt, "YYYY")) YYYY OF TABLE1),

    (SELECT 1 Q, M '01' FROM DUAL

    UNION ALL SELECT 2 Q, M '04' FROM DUAL

    UNION ALL SELECT 3 Q, M '07' FROM DUAL

    (UNION ALL SELECT 4 Q, '10' FROM DUAL M) Q)

    Not even a week, YOU will understand what this request is supposed to look like. And no ONE will be able to reproduce the query or test it.

    v_query_string: = ' SELECT... » ;

    DBMS_OUTPUT. Put_line (v_query_string); -Now you can actually SEE what query is used and test it manually

    BECAUSE me in v_query_string

    Once 'v_query_string' does not add the actual as a comment in the code query so that later there's someone test with a real query.

      LOOP
         v_alterstring: = i.xyz;
         EXECUTE IMMEDIATE v_alterstring;
      END LOOP;

    This code DOES not yet - it until it works:

    LOOP

    DBMS_OUTPUT. Put_line (i.xyz); -run and test manually

    -I.xyz EXECUTE IMMEDIATE.  -NO. - not until you have executed and tested manuallyl queries

    END LOOP;

    Same here - a time that the code works adds at least ONE query real to the code as a comment, so that someone looking at the code knows what applications should actually look like.

  • procedure to run every month only once if I press the button

    Hi........

    I want to run the procedure every month once, if I press the new button in the same month I want displaying the message "executed procedure.
    in fact I used the function procedure when the shutter release button

    I wrote this code

    Declare
    number of v_months;
    date of T_DATE;
    Start
    v_months: = 0;
    SELECT TO_CHAR (ADD_MONTHS(sysdate,v_months), 'DD-MON-YYYY') in the T_DATE FROM DUAL;
    If T_DATE = sysdate and: CONTROL_1.COST_AFTER_DEPR is not null then
    DEPRECIATE_PKG.main;

    elsif: CONTROL. ASSET_GROUP is null then
    fnd_message.set_string ("asset is not available");
    fnd_message. Show();
    raise form_trigger_failure;

    elsif: CONTROL_1.COST_AFTER_DEPR = 0 then
    fnd_message.set_string ("' complete depreciation");
    fnd_message. Show();
    raise form_trigger_failure;
    end if;

    end;

    How can I please give me a solution

    Concerning
    Maha

    Hello

    You should have a database table to store the fact that the procedure was performed for a given month:

    create table t_monthly_procedure
    (
      ddate  date
    )
    

    If the procedure was executed this month then test in your code. Otherwise, you insert a row

    Declare
      ln$dummy pls_integer;
    Begin
      select 1
      into  ln$dummy
      where exists
      ( select 1 from t_monthly_procedure
        where to_char(ddate,'YYYYMM') = to_char(sysdate,'YYYYMM')
      );
      -- found ? --
      -- do nothing or raise a message --
    Exception
      when no_data_found then
       -- nothing done for this month, so insert --
      insert into t_monthly_procedure (ddate) values (sysdate) ;
    End;
    

    François

  • How do we know time for executing a procedure or a plsql block

    Hello

    I have to set a procedure in 11g.

    My request is how to know how much time procedure takes to run.

    Please suggest.

    Thank you
    VInod

    Hello

    SQL> ed
    Wrote file afiedt.buf
    
      1   declare
      2   l_start number;
      3   l_end number;
      4   l_diff number;
      5  begin
      6   l_start := dbms_utility.get_time ;
      7    for i in 1..10
      8     loop
      9    dbms_output.put_line('i= '|| i);
     10    end loop;
     11   l_end := dbms_utility.get_time ;
     12    dbms_output.put_line('l_start ='||l_start);
     13    dbms_output.put_line('l_end ='||l_end);
     14   l_diff := (l_end-l_start)/100;
     15  dbms_output.put_line('Elapsed Time: '|| l_diff ||' secs');
     16* end;
    SQL>
    SQL> /
    i= 1
    i= 2
    i= 3
    i= 4
    i= 5
    i= 6
    i= 7
    i= 8
    i= 9
    i= 10
    l_start =25985278
    l_end =25985278
    Elapsed Time: 0 secs
    
    PL/SQL procedure successfully completed.
    

    Thank you

    Published by: prakash on 8 February 2012 21:55

  • PL/PDF - procedure test1 runs but gives error

    Hi all

    I have Oracle XE 10 g with Oracle Apex, and recently I installed PL/PDF in the same. I tried to run the headerfooter procedure given in the installation guide. But it is giving error ORA-20000: error ERR-006 procedure call: xxfooter. How can I get the header and footer of the headerfooter procedure?

    -create a page header footer procedure

    CREATE or REPLACE procedure headerfooter
    /* 7. Example: Number of header, footer of pages * /

    l_blob blob.
    Start

    / * Initialization, without means of parameters:
    -the page orientation: portrait
    -Unit: mm
    -default page size: A4 * /.
    plpdf.init;

    / * Sets the alias page number.
    Default: {nb} * /.
    plpdf.nopAlias;

    / * Sets the name of the procedure to page header. Transmitted program name
    as a parameter runs when the page header is created. */
    plpdf. () SetHeaderProcName
    p_proc_name = > "xheader"-procedure Page header name: xheader
    p_height = > 10 - height of header section
    );

    / * Sets the name of the footer procedure. Transmitted program name
    as a parameter runs when the footer is created. */
    plpdf. () SetFooterProcName
    p_proc_name = > 'xfooter',-name of procedure for the Page footer: xfooter
    p_height = > 10 - footer section height
    );

    / * Start a new page, without means of parameters:
    -the page orientation: by default (portrait) * /.
    plpdf. NewPage;

    / * Sets the police and its properties * /.
    plpdf. () SetPrintFont
    p_family = > 'Arial',-are family: Arial
    p_style = > null,-font style: normal (default)
    p_size = > 12 - font size: 12 points
    );

    / * Draw a rectangle cell with text inside. */
    plpdf. PrintCell)
    p_w = > 50,-the width of the Rectangle
    p_h = > 10, - height of the Rectangle
    p_txt = > 'Page 1' - text in rectangle
    );

    / * Start a new page, without means of parameters:
    -the page orientation: by default (portrait) * /.
    plpdf. NewPage;

    / * Draw a rectangle cell with text inside. */
    plpdf. PrintCell)
    p_w = > 50,-the width of the Rectangle
    p_h = > 10, - height of the Rectangle
    p_txt = > "Page 2" - text in rectangle ".
    );

    / * Returns the generated PDF document.
    The document is closed and then returned in the OUT parameter. */
    plpdf. SendDoc)
    p_blob = > l_blob - the generated document
    );


    / * Print it: * /.

    owa_util.mime_header('application/pdf',false);
    HTP.p ("Content-Length: ' |") DBMS_LOB.GetLength (l_blob));
    owa_util.http_header_close;
    wpg_docload.download_file (l_blob);
    end;


    -Create a footer procedure

    CREATE or REPLACE the procedure xfooter is
    Start
    / * Sets the police and its properties * /.
    plpdf. () SetPrintFont
    p_family = > 'Arial',-are family: Arial
    p_style = > 'I', - font style: italic
    p_size = > 8 - Font size: 8pt
    );

    / * Print the page number * /.

    / * Draw a rectangle cell with text inside. */
    plpdf. PrintCell)
    p_w = > 0,-the width of the Rectangle
    p_h = > 10, - height of the Rectangle
    p_txt = > to_char (plpdf. CurrentPageNumber) | ' / {nb}', - text in rectangle
    p_border = > '0',-without frame
    p_ln = > ' 0', - the cursor position after the cell is printed: next
    p_align = > 'C' - text alignment: Center
    );

    end;


    Thank you.

    PL/PDF using "immediate execution" to call a procedure header and footer as the owner of plpdf. If the header/footer of the procedure owner is different plpdf owner in the main proceedings you need to 'grant' (and 'synonym') to the owner of plpdf.

  • Run pubs "in the clause.

    Hello world

    I try to use Execute pubs with "en" clasue in there. Here is the code that I have
    create or replace PROCEDURE test (COLUMN_NAME VARCHAR2) is
    
    VAR_VALUE NUMBER;
    
    lv_sql  varchar2(4000);
    
    begin
    --DBMS_OUTPUT.PUT_LINE()
    lv_sql := 'SELECT MAX('||':column_name'||') FROM AUTHORIZATION_X';
    DBMS_OUTPUT.PUT_LINE (lv_sql);
    execute immediate lv_sql into var_value
    using column_name;
    DBMS_OUTPUT.PUT_LINE (to_char(VAR_VALUE));
    
    end; 
    This is the simplest code that I use. I need to pass a 'name cloumn' in a table and I try to get the max value in this table and display.
    I'm getting some 'not a sql valid' error when I use the code above.

    Please correct my code is there is nothing wrong in.

    and in some documents I've seen: 1: 2:3 ratings where we need to pass parameters to the dynamic sql statements. Should it be in any order?

    Thank you
    Phani

    Marella Phani wrote:
    Hi blushadow and sean.

    Thanks for the reply...

    In fact, we do periodic refersh of the prod database for test, development environment. In this update of the test, dev environments sequences become out of sync (I think).

    Sean... Yesterday I read somewhere that "we must delete and recreate sequences if we start the sequence with the new value' '

    I'll try this coomand rather 'ALTER SEQUENCE your_seq INCREMENT BY x"and get back to you if I have a problem...

    Here is an example of reset sequences...

    {code}
    SQL > select test.nextval from double;

    NEXTVAL
    ----------
    125

    SQL > v_inc var number;
    SQL > v_resetno var number;
    SQL > exec: v_resetno: = 50;

    PL/SQL procedure successfully completed.

    SQL > exec 'select-(test.nextval-:x)-1 of the double' immediate execution in: using v_inc: v_resetno;

    PL/SQL procedure successfully completed.

    SQL > exec immediately executes ' change increment test sequence of '. : v_inc;

    PL/SQL procedure successfully completed.

    SQL > select test.nextval from double;

    NEXTVAL
    ----------
    49

    SQL > alter the test sequence increment by 1.

    Modified sequence.

    SQL > select test.nextval from double;

    NEXTVAL
    ----------
    50

    SQL > select test.nextval from double;

    NEXTVAL
    ----------
    51

    SQL >
    {code}

    Sean and blushadow... I saw using: 1: 2:3 in dynamic sql. How do I use this syntax? who should be in a particular order?
    can we use other names?

    Yes, you can as in my sample code above. The bind variable are just placeholders, so you can call it what you like. What you should remember, is that you can only bind in values, not the column names or table names.

  • Firefox.exe * 32 to 99% of the CPU is running and blocking WHY?

    so on two different PCs, we have problems with firefox as soon as launch you it, it goes back to 99% cpu ussage and freezes.
    I did a complete uninstall and reinstall as running revo and delete all entries from firefox on the registry. It does this even in safe mode. two of them are under windows 7.

    SO I actually so I think somehow in the properties of the shortcut on two pcs theses he had set up to run in mode of compatibility windows xp service pack 2. a defeated this box, and everything seems to work... Don't know how or why it has been verified but its market while what matters.

  • #3128 error: Disk i/o error occurred. "", details: ', operation: 'run' error blocks Adobe Muse "

    [SQLS/internalExecute] SQLError: ' error #3128: disk i/o error has occurred. "", details: ', operation: 'running' "

    See the responses of Zak in a forum post the related internalExecute/SQLS-SQLError: ' error #3128: disk i/o error has occurred. ", details:", operation:' carried out by "

  • I am back! test a procedure through PL/SQL block

    Hi all!

    Do you know how to test a procedure? Please check mine, its gave me an error of what follows:-see the bottom of my test pls/sql code:
    ORA-06550: line 4, column 1:
    PLS-00306: wrong number or types of arguments in the call to 'MEMBER_CK_SP '.
    ORA-06550: line 4, column 1:
    PL/SQL: Statement ignored
    2 lv_name varchar2 (20);
    3. start to
    4 member_ck_sp('rat55','kile',lv_name);
    5 end;
    6. /

    CREATE OR REPLACE PROCEDURE member_ck_sp
    (p_id IN VARCHAR2,
    p_pw IN OUT VARCHAR2,
    p_cook ON the NUMBER,
    p_check OUT VARCHAR2)
    IS
    BEGIN
    SELECT firstname. » '|| LastName, cookie
    IN p_pw, p_cook
    OF bb_shopper
    WHERE username = p_id
    AND password = p_pw;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    p_check: = 'INVALID ';
    END;
    /
    -This is the test of the procedure-
    declare
    lv_name varchar2 (20);
    Start
    member_ck_sp ('rat55', 'kile', lv_name);
    end;
    /

    For not being "Captain obvious" but your procedure takes 4 parameters, and you go to 3... so the wrong number of arguments error...

  • Why did my system hang when I run this block

    When I run this query, why my oracle stop reponding
    and after a while a start-up ifinite output...
    *******************************
    declare
    v_nextval varchar2 (10);
    cursor c6 is
    (select double seq_a.nextval);
    Start
    Open c6;
    loop
    extract the c6 in v_nextval;
    When the output v_nextval < = 10;
    dbms_output.put_line (v_nextval);
    end loop;
    Close c6;
    end;
    /
    *****************************

    kinkly take a look on this

    Thank you

    Maybe something like that.

    >
    Suppose that in my neck of table A
    last value inserted 258
    I've migrated database from sql server 2005 to oracle 10g
    where currval sequences initailized and last value is not 1

    now I m creating a new sequence, but I do want to mention Startwith 258

    So how do
    >

    SQL> select 'create sequence sequence_' || chr(level + 64)  || ' start with 1 ; ' from dual
      2  connect by level <= 2;
    
    'CREATESEQUENCESEQUENCE_'||CHR(LEVEL+64)||'ST
    ---------------------------------------------
    create sequence sequence_A start with 1 ;
    create sequence sequence_B start with 1 ;
    
    SQL> create sequence sequence_A start with 1 ;
    
    Sequence created.
    
    SQL> create sequence sequence_B start with 1 ;
    
    Sequence created.
    
    SQL> create table table_A
      2  (
      3   sno number
      4  )
      5  /
    
    Table created.
    
    SQL>
    SQL> insert into table_a
      2  select level from dual connect by level <= 10;
    
    10 rows created.
    
    SQL>
    SQL> create table table_b
      2  (
      3   sno number
      4  )
      5  /
    
    Table created.
    
    SQL>
    SQL>
    SQL> insert into table_b
      2  select level from dual connect by level <= 20;
    
    20 rows created.
    
    SQL> with mapping_table
      2  as
      3  (
      4   select 'sequence_a' sequence_name, 'table_a' tname, 'sno' column_name from dual
      5   union all
      6   select 'sequence_b', 'table_b', 'sno' from dual
      7  ),
      8  max_value_table
      9  as
     10  (
     11   SELECT
     12       sequence_name,
     13       to_number(
     14         extractvalue(
     15           xmltype(
     16    DBMS_XMLGEN.getxml('select max(' || column_name || ') c from '||tname))
     17           ,'/ROWSET/ROW/C')) max_value
     18  FROM mapping_table
     19  )
     20  select * from max_value_table;
    
    SEQUENCE_N  MAX_VALUE
    ---------- ----------
    sequence_a         10
    sequence_b         20
    
      1* select * from user_sequences where sequence_name in ('SEQUENCE_A','SEQUENCE_B')
    SQL> /
    
    SEQUENCE_NAME                   MIN_VALUE  MAX_VALUE INCREMENT_BY C O CACHE_SIZE LAST_NUMBER
    ------------------------------ ---------- ---------- ------------ - - ---------- -----------
    SEQUENCE_A                              1 1.0000E+27            1 N N         20           1
    SEQUENCE_B                              1 1.0000E+27            1 N N         20           1
    
    SQL> with mapping_table
      2  as
      3  (
      4   select 'sequence_a' sequence_name, 'table_a' tname, 'sno' column_name from dual
      5   union all
      6   select 'sequence_b', 'table_b', 'sno' from dual
      7  ),
      8  max_value_table
      9  as
     10  (
     11   SELECT
     12       sequence_name,
     13       to_number(
     14         extractvalue(
     15           xmltype(
     16    DBMS_XMLGEN.getxml('select max(' || column_name || ') c from '||tname))
     17           ,'/ROWSET/ROW/C')) max_value
     18  FROM mapping_table
     19  ) ,
     20  sequence_collation
     21  as
     22  (
     23   select us.sequence_name, us.increment_by, mvt.max_value from user_sequences us, max_value_Table mvt
     24   where
     25       us.sequence_name = upper(mvt.sequence_name)
     26  ),
     27  sequence_exec_order
     28  as
     29  (
     30  select 1 execution_sequence, 'alter sequence ' || sequence_name || ' increment by ' || max_value || ';' text from sequence_collation
     31  union all
     32  select 2, 'select ' || sequence_name || '.nextval from dual ; ' from sequence_collation
     33  union all
     34  select 3, 'alter sequence ' || sequence_name || ' increment by ' || increment_by || ' ;' from sequence_collation
     35  )
     36  select text from sequence_exec_order order by execution_sequence
     37  /
    
    TEXT
    -----------------------------------------------------------------------------------------------------
    alter sequence SEQUENCE_A increment by 10;
    alter sequence SEQUENCE_B increment by 20;
    select SEQUENCE_A.nextval from dual ;
    select SEQUENCE_B.nextval from dual ;
    alter sequence SEQUENCE_A increment by 1 ;
    alter sequence SEQUENCE_B increment by 1 ;
    
    6 rows selected.
    
    SQL> alter sequence SEQUENCE_A increment by 10;
    
    Sequence altered.
    
    SQL> alter sequence SEQUENCE_B increment by 20;
    
    Sequence altered.
    
    SQL> select SEQUENCE_A.nextval from dual ;
    
       NEXTVAL
    ----------
            10
    
    SQL> select SEQUENCE_B.nextval from dual ;
    
       NEXTVAL
    ----------
            20
    
    SQL> alter sequence SEQUENCE_A increment by 1 ;
    
    Sequence altered.
    
    SQL> alter sequence SEQUENCE_B increment by 1 ;
    
    Sequence altered.
    
    SQL> select * from user_sequences where sequence_name in ('SEQUENCE_A','SEQUENCE_B')
      2  /
    
    SEQUENCE_NAME                   MIN_VALUE  MAX_VALUE INCREMENT_BY C O CACHE_SIZE LAST_NUMBER
    ------------------------------ ---------- ---------- ------------ - - ---------- -----------
    SEQUENCE_A                              1 1.0000E+27            1 N N         20          11
    SEQUENCE_B                              1 1.0000E+27            1 N N         20          21
    

    Concerning

    REDA

    P.S: query of dbms_xmlgen old posts in this forum...

Maybe you are looking for