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.

Tags: Database

Similar Questions

  • 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

  • Collection of the dynamic query

    Hi All-

    I'm trying to get the value of the collection through the dynamic query but I am facing some problem please let me know that I hurt.

    Created a function like below to run the dynamic query to select statement

    create or replace FUNCTION rfunGetColumnValue (
                  ColumnName VARCHAR2,
                  TableName  VARCHAR2,
                  DefaultValue OUT VARCHAR2,
                  Criteria VARCHAR2)
           RETURN VARCHAR2
    IS
           ReturnValue VARCHAR2 (32767 byte) ;
           Stmt        VARCHAR2 (32767 byte) ;
    BEGIN
           stmt := 'begin        
    select '|| ColumnName || ' into  :1  from table(:2) ' ||NVL
           ( Criteria, ' ') ||
           '       
    Fetch First Row only ;        
    EXCEPTION                                   
    WHEN OTHERS THEN                                          
    :2 := SQLERRM;
    end;'
           ;
           dbms_output.put_line (stmt) ;
           EXECUTE IMMEDIATE stmt USING OUT ReturnValue, OUT DefaultValue;
           --select Valueinto into Returnvalue from dual;
           RETURN ReturnValue;
    END;
    

    Now, I created a folder in the Package

    create or replace PACKAGE Collection_PKG
    is
    type Bank_rec is RECORD
    (
    SNO           NUMBER(10),    
    BANKID        NUMBER(5),    
    BANKNAME       VARCHAR2(50),    
    BANKSC         VARCHAR2(50),    
    ADDEDIT       varchar2(1),    
    COMPID        number(5),    
    ISBULK        number(1),    
    ROWNO         number(10),    
    ERROR         VARCHAR2(500)  
    );
    
    
    TYPE Bank_tbl IS TABLE OF Bank_rec;
    --type Bank_cur is ref cursor return Bank_rec;
    
    
    end Collection_PKG;
    
    end Collection_PKG;
    end Collec
    tion_PKG;
    

    Now, when I'm Trying the code below

    DECLARE
      V_EXECQUERYPARAM XMLTYPE:= XMLTYPE('<QueryParam>
      <BankXML>
        <Bank>
          <BankID>0</BankID>
          <BankSC><![CDATA[RCB]]></BankSC>
          <BankName><![CDATA[Royal challenger Bank]]></BankName>
          <IsBulk>0</IsBulk>
          <AddEdit>A</AddEdit>
        </Bank>
      </BankXML>
    </QueryParam>');
    BEGIN
     Rspbanksave(
        v_SPParamList => V_EXECQUERYPARAM  );
    
    
    END; 
    

    create or replace PROCEDURE rspBankSave (
                  v_SPParamList XMLTYPE DEFAULT NULL)
    IS
           V_Addedit VARCHAR2 (1 CHAR) ;
           Bank_tbl Collection_PKG.BANK_TBL := Collection_PKG.BANK_TBL () ;
    BEGIN
           
           SELECT Row_number () OVER (ORDER BY 1),
                  XT.BankID,
                  XT.BankName,
                  XT.BankSC,
                  XT.AddEdit,
                  v_CompID,
                  XT.IsBulk,
                  CAST (0 AS NUMBER (5)),
                  CASE
                         WHEN MBank.BankID IS NOT NULL
                         THEN
                                CASE
                                       WHEN XT.BankSC     = MBank.BankSC
                                          AND XT.BankName = MBank.BankName
                                       THEN 'R104|Entry Already Exist,R114|Short Code Already Exist'
                                       WHEN XT.BankSC = MBank.BankSC
                                       THEN 'R114|Short Code Already Exist'
                                       WHEN XT.BankName = MBank.BankName
                                       THEN 'R104|Entry Already Exist'
                                END
                         ELSE NULL
                  END Bulk collect
           INTO   Bank_tbl
           FROM   XMLTABLE ('//QueryParam/BankXML/Bank' PASSING v_SPParamList COLUMNS BankID NUMBER (5)
                  PATH 'BankID', BankName                                                    VARCHAR2 (
                  50) PATH 'BankName', BankSC                                                VARCHAR2 (
                  50) PATH 'BankSC', AddEdit                                                 VARCHAR2 (
                  1) PATH 'AddEdit', IsBulk                                                  NUMBER (1)
                  PATH 'IsBulk') XT
           LEFT JOIN MBank
           ON     XT.BankID   != MBank.BankID
              AND v_CompID     = MBank.CompID
              AND (XT.BankSC   = MBank.BankSC
               OR XT.BankName  = MBank.BankName) ;
           v_TotalRowCount    := SQL%ROWCOUNT;
    
    
    
    
    
    
           IF (v_TotalRowCount > 0) THEN
                  
                         BEGIN
                               V_Addedit:=rfunGetColumnValue (ColumnName=> 'Upper(AddEdit)',TableName=>'table(Bank_tbl)',DefaultValue=>'',Criteria =>'');
                         END;
                         --SQL Code here
                  
           END IF;
           
    END rspBankSave;
    
    
    
    
    
    
    
    

    As I've suggested before:

    To get the name of the table the column

    and as others have:

    Type global temporary Tables vs. table

    If you give more context, more information about the bigger picture, more information about what you're trying to do and why you're going down the road you go down, you can return more useful information. But you seem reluctant to do.

    For the moment, your recent posts seem to just raise the same type of question - why are you doing this?

    The normal way to return data to a client is a refcursor.

    It is the most effective way.

    Not through collections that you seem to be put on the must-do approach.

  • The dynamic function of question regarding

    Hello

    Please find the attachment for the required scripts.

    Please help me how to run a package function dynamically in anonymous block. I tried to use EXECUTE IMMEDIATE but did not work.

    My requirement is I have a lot of emp_demo in which it contains 3 functions and I've created a lookup table which are inserted the names of functions. then I tried to read a function name after another using the loop and execution, but it shows PLS-00382: expression is of type incorrect error.

    Please suggest.

    Kind regards

    Phani.

    Hey Brad,

    Try this

    set serveroutput on
    declare
      plsql_block varchar2(200);
      c1 sys_refcursor;
      v_empno number;
      v_ename varchar2(20);
      v_job varchar2(20);
    begin
      for r in(select name as function_name from lt_emp_demo)
      loop
        plsql_block := replace('begin :rc := emp_demo.@FUNCTION; end;', '@FUNCTION', r.function_name);
        dbms_output.put_line(plsql_block);
        --
        EXECUTE IMMEDIATE plsql_block USING OUT c1;
        --
        fetch c1 into v_empno,v_ename,v_job;
        dbms_output.put_line(v_empno || ', ' || v_ename || ', ' || v_job);
      end loop;
    end;
    /
    
    anonymous block completed
    begin :rc := emp_demo.rpt_emp1; end;
    7369, SMITH, CLERK
    begin :rc := emp_demo.rpt_emp2; end;
    7654, MARTIN, SALESMAN
    begin :rc := emp_demo.rpt_emp3; end;
    7844, TURNER, SALESMAN
    

    See http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/dynamic.htm#LNPLS011

    "Dynamic SQL is a programming methodology to build and run SQL statements at run time. This is useful when the time writing programs versatile and flexible as ad hoc query systems, when you write programs that must run the database (DDL) instructions definition language, or when you don't know at compile time the full type of statement, the number or data SQL of its input and output variables. »

  • The dynamic tab programmatically (jhsDynTabContext)

    Hello!
    In our application, we are using JHeadstart 11.1.1.3. Dynamic tabs are enabled by using jhsDynTabContext, bean (class oracle.jheadstart.view.dyntab.DynTabContext.java).
    I'm trying to open a dynamic tab by program and I need to call DynTabContext.getCurrentInstance () to get the context of the tab to open a new tab, but the method returns null. How is it?
    I went to see the code and he's trying to get through the expressions ' #{viewScope.jhsDynTabContext} "or" #{pageFlowScope.jhsDynTabContext} ". Where and how can I set them? Or what is the most common procedure by opening the dynamic tabs programmatically?
    Best regards, Marko

    Marko,

    Indeed, my fault, the jhsDynTabContext is stored in viewScope.
    However, another approach could be much simpler to implement.
    JHeadstart is supported by a dynamic tab open of in another dynamic tab using an object with display type groupLink and the 'Show Linked Group In' dynamic 'New Tab' value

    I don't know exactly your use case, but if he really needs to be done by programming, then you can apply the same technique as we do with the Group link:
    -set the name of the taskflow which must be opened in new tab on the successful jhsDynTabLauncher bean (defined in the TF model)
    -move the jhsDynTabLauncher to the parentContext
    -use the result of the "LaunchTab" action, this triggers a parent (also defined in the TF model) action picked up in the taskflow boundless that launches the new tab using the now available in the parentContext jhsDynTabLauncher.

    Steven Davelaar,
    JHeadstart team.

  • Dbms_metadata in a stored procedure. If the table is in the schema, run the stored procedure the procedure works very well.  If I try to get the table ddl to a different scheme it can't find table in a schema.  I run as an anonymous blocks and it works

    create or replace FUNCTION get_table_md (p_owner in varchar2, p_table IN VARCHAR2) RETURN CLOB IS
    -Define local variables.
    / * declare
    p_owner varchar2 (30): = "AVTYM";
    p_table IN VARCHAR2 (30): = "TRANSACTION_HEADER";
    */
    h NUMBER; -handle returned by OPEN
    e NUMBER; -handle returned by ADD_TRANSFORM
    p_tableref varchar2 (30);
    doc CLOB.
    Doc2 CLOB.
    BEGIN

    -Specify the type of object.
    h: = DBMS_METADATA. OPEN ('TABLE');

    -Use filters to specify the desired object.
    DBMS_METADATA. SET_FILTER (h, 'SCHEMA', p_owner);
    DBMS_METADATA. SET_FILTER (h, 'NAME', p_table);

    -Request that the metadata be transformed into creation DDL.
    th: = DBMS_METADATA. ADD_TRANSFORM (h, 'DDL');

    -Retrieves the object.
    doc: = DBMS_METADATA. FETCH_CLOB (h);


    -Free resources.
    DBMS_METADATA. Close (h);
    p_tableref: = substr (p_table, 1, 25). ' $RDEF';
    Doc2: is REGEXP_replace(doc,p_table,p_tableref,1,1,'im');.
    doc: = REGEXP_replace(doc2,'"CREATE_DT"','"EXCHANGE_DT"',1,2,'im');
    -dbMS_OUTPUT. Put_line (doc);
    RETURN doc;

    END;

    Hello

    check the privilege you may have granted by a role that you need direct access to the object and not by the role. You can test if you are granted by a role, by running the SET command role no and see if you can still run the anonymous block.

    Thank you

  • The procedure entry point?getText@FxtField@@QBE? AVFXWString@@XZ could not be located in the dynamic linklibrary fox.dll

    I get the error message "the procedure point?getText@FxtField@@QBE entry? "AVFXWString@@XZ could not be located in the dynamic linklibrary fox.dll ' when I boot.  How should I do?

    Looks like it has something to do with the Acronis software, there is an old post here: -.

    http://Forum.Acronis.com/Forum/6553

    If it is of no use and that you use the disk imaging software and then uninstall it or go to start/run type msconfig press enter and edit startup.

  • Could not load the turbo tax software & this message "the EncodePointer point procedure entry is not found in the dynamic library KERNELL32.dll.

    Original title: while loading turbo tax software & this message. The procedure entry point EncodePointer be found in the dynamic library KERNELL32.dll.     can someone tell me how to solve this problem?

    I have windows xp 2002 Service Pack 2

    Hi henryjeshom,

    ·         Did you do changes on the computer before the show?

    Follow these methods.

    Method 1: Uninstall and reinstall the application of Turbo tax.

    How to change or remove a program in Windows XP

    http://support.Microsoft.com/kb/307895

    Method 2: Perform a clean boot to see if there is a conflict of software like the clean boot helps eliminate software conflicts.

    How to configure Windows XP to start in a "clean boot" State

    http://support.Microsoft.com/kb/310353

    Note: After completing the steps in the clean boot troubleshooting, follow the section How to configure Windows to use a Normal startup state of the link to return the computer to a Normal startupmode.

    After the clean boot used to resolve the problem, you can follow these steps to configure Windows XP to start normally.

    (a) click Start, run.

    (b) type msconfigand click OK.

    (c) the System Configuration Utility dialog box appears.

    (d) click the general tab, click Normal startup - load all services and device drivers and then click OK.

    (e) when you are prompted, click on restart to restart the computer.

    If the problem persists, contact support for Turbo tax for more help and information.

    http://TurboTax.Intuit.com/support/

  • Starting problems. - RunDLL32.exe, procedure entry point_except_handler4_common could not be located in the dynamic link librarymsvcrt.dll

    I get the message RunDLL32.exe, procedure entry point_except_handler4_common could not be located in the dynamic link librarymsvcrt.dll. What should I do?

    I had starting problems, boot loop, I think it seems to have been resolved by using the last known good configuration, but I get this popup dialog box. I've not closed for fear that it will start XP looping again.

    Hi EddieBryan,

    1. did you of recent changes on the computer?

    2. do you have security software installed on the computer?

    3. when exactly you receive the error message?

    Method 1
    Check if the problem persists in safe mode and after return with the result.
    A description of the options to start in Windows XP Mode
    http://support.Microsoft.com/kb/315222

    Method 2
    If the problem does not persist in safe mode, then it is possible that some third-party programs installed on the computer is causing the problem.
    I suggest that you configure the computer in a clean boot state and check if it helps.
    To help resolve the error and other messages, you can start Windows XP by using a minimal set of drivers and startup programs. This type of boot is known as a "clean boot". A clean boot helps eliminate software conflicts.
    See section to learn more about how to clean boot.
    How to configure Windows XP to start in a "clean boot" State
    http://support.Microsoft.com/kb/310353

    Reset the computer to start as usual
    When you are finished troubleshooting, follow these steps to reset the computer to start as usual:
    1. click on Start , then click run.
    2. type msconfig , then click OK.
    The System Configuration Utility dialog box appears.
    3. click on the general tab, click Normal Startup - load all services and device drivers and then click OK.
    4. When prompted, click on restart to restart the computer.

    Method 3

    If the previous step fails then I suggest that scan you SFC on the computer that will search the corrupted system files and try to correct them.

    The analysis may take some time, so be patient. Windows allows to fix corrupt or missing files it finds. If the information of the installation CD is required to fix the problem, you may be asked to insert your Windows XP installation CD.

    Description of Windows XP and Windows Server 2003 System File Checker (Sfc.exe)

    http://support.Microsoft.com/kb/310747

    You are prompted to insert a Windows XP SP2 CD when you try to run the tool on a Windows XP SP2 computer system File Checker

    http://support.Microsoft.com/kb/900910

  • Not able to install kies 3 get "the procedure entry point? _xmem@Tri@STD@@YAXXZ could not be located in the dynamic link library msvcp90.dll.

    Original title: ? _xmem@tri@std@@yaxxz error

    I'm running kies 3 so I can move video from my phone to my computer, I downloaded the program and I get this error message... [THE PROCEDURE ENTRY POINT? _XMEM@TRI@STD@@YAXXZ WAS NOT FOUND IN THE DYNAMIC LINK LIBRARY MSVCP90.] DLL.] I have installed and uninstalled this program a few times now and keep the same error, I also ran Guest [sfc/scannow] and there was no breach of integrity don't know what else to do, I'm running vista 64 premium.

    This fix by installing the following:

    http://www.Microsoft.com/en-US/Download/details.aspx?ID=5582

  • Error 'the procedure entry point xmlTextReaderConstName' not found in the dynamic link library libxml2.dll when you connect to the computer

    Original title:

    I get this pop-up when I connect: 'the procedure entry point not found xmlTextReaderConstName in the dynamic link library libxml2.dll.'  What should I do to fix this?

    Hello

    1. are you able to connect next to this error?

    2. are you aware of any changes made to the computer, before the show?

    Method 1:

    Step 1: Safe Mode

    Start your computer in safe mode and check the number.

    Start your computer in safe mode

    http://Windows.Microsoft.com/en-us/Windows7/start-your-computer-in-safe-mode

    Step 2: Clean boot

    If you are not facing the problem in safe mode, and then put your computer in a clean boot and search for the question.

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    http://support.Microsoft.com/kb/929135

    Note: When you have finished the clean boot procedure, follow step 7 in the article to restore your computer to normal startup.

    Method 2:

    Run a SFC system analysis and control for the issue.

    How to use the System File Checker tool to fix the system files missing or corrupted on Windows Vista or Windows 7

    http://support.Microsoft.com/kb/929833

    Method 3:

    Follow these steps.

    a. open windows Explorer, navigate to the following location:

    For 64-bit.

    C:\Program Files (x 86) \Common Files\Apple\Apple Application Support

    For 32 bit,

    C:\Program Files \Common Files\Apple\Apple Application Support

    b. copy the file "libxml2.dll.

    c. open new windows Explorer, navigate to the following location:

    For 64-bit.

    C:\Program Files (x 86) \Common Files\Apple\Mobile Device Support

    For 32 bit,

    C:\Program Files \Common Files\Apple\Mobile Device Support

    d. Paste the file 'libxml2.dll' at the location.

    e. restart your computer.

    I hope this helps.

  • The procedure entry point LdrSystemDllInitBlock could not be located in the dynamic link library ntdll.dll

    I was not able to use a particular computer since Wednesday morning, August 14, 2013.  The error dialog box. "The procedure entry point not found LdrSystemDllInitBlock in the dynamic link library ntdll.dll" on almost every application I try to open that includes IE, FireFox and Chrome browsers.  System/Windows Control Panel applications seem to work but nothing else.  I tried to do a restore of the system on several points before August 14, nothing helps.  That is that I keep getting this error on every application dialog box.  Is there one resolution other than backup can I reinstall Windows?

    Hi David,

    1. you remember changes to the computer before the show?

    2 the computer sits in a field?

    This problem may occur if the ntdll.dll file is damaged.

    Here are some ways you can follow to resolve the problem:

    Method 1:

    I suggest that you run SFC scan to check for missing or damaged system files. To do this, follow the steps mentioned in the link:
    How to use the System File Checker tool to fix the system files missing or corrupted on Windows Vista or Windows 7
    http://support.Microsoft.com/kb/929833

    Method 2:

    I suggest you to re-register the dll (Dynamic Link Library) file from an elevated command prompt.

    a. click Start.

    b. type Cmd.exe.

    c. right-click on cmd.exe and select run as administrator.

    d. type regsvr32 ntdll.dll and press enter.

    Method 3:

    Step 1:

    You can try to start in safe mode and check if the problem persists. Only basic files and drivers needed to run Windows are started. If a problem doesn't reappear when you start in safe mode, you can eliminate the default settings and basic as possible cause device drivers. To start in safe mode follow the link.

    http://Windows.Microsoft.com/en-us/Windows7/start-your-computer-in-safe-mode

    Step 2:

    If the problem does not occur in safe mode then boot to the desktop in normal mode and check that the third-party program is causing the problem. To configure your computer to clean boot follow the link below.

    How to perform a clean boot for a problem in Windows Vista, Windows 7 or Windows 8
    http://support.Microsoft.com/kb/929135

    Note: See "How to reset the computer to start as usual after a clean boot troubleshooting"

    under more information to prepare the computer to start as usual after a repair.

    Hope this solves the problem. If the problem persists, you can write to us and we will be happy to help you further.

  • The "procedure entry point sqlite3_prepare_v2 could not be found in the dynamic link library sqlite3.dll.

    I try to run Rosetta Stone software, however whenever I click on the application link (or shortcut) this annoying message keeps popping up that, according to the "procedure entry point sqlite3_prepare_v2 could not be found in the dynamic link library sqlite3.dll. I studied this before, and there seems to be a problem with Apple/iTunes. But when I deleted iTunes, this question always arises. If there is someone out there or in the it Department which can be useful with this question please help!

    Thank you in advance!

    Hello

    1. are you able to launch the program?

    2. What is the version of iTunes installed on your computer?

    Please follow the methods.

    Method 1:

    Run the Microsoft fixit to uninstall iTunes and check.

    See the link.

    http://support.Microsoft.com/mats/program_install_and_uninstall/

    Method 2:

    Copy the file in the Common Files\Apple\Apple Application Support folder in the Common Apple Mobile Device Support folder and check if it works very well.

  • Unit test: is there a way to make the dynamic query of the value of running after the boot process?

    I wonder why the dynamic value query is executed before the boot process? Logically, it makes sense to run after them.

    For example, I test a stored procedure that is supposed to delete a record, and I'd like to create this test report should be deleted as part of the startup process before execution of the stored procedure call to delete this test record. Apparently the dynamic query of value not returns not the test report in as long as the query parameter to call the stored procedure under test, which makes me think that is executed before the startup process of design...

    Please advise...

    Thank you

    Val

    As this thread does no traction/attention of the team of SQL Developer for a while, I had to submit a request for formal improvement on metalink:

    RE: 19834977 - IN THE UNIT TEST REQUEST TO ALLOW TO CHANGE THE ORDER OF EXECUTION OF THE START OF THE PROCESS

    Thank you

    Val

  • How to fix the error, "the procedure entry point PK11_PubDerive could not be found in the dynamic link library nss3.dll

    I use windows 7 and Firefox 39.0. Recently, when I open Firefox it gives this error, 'the entrance of procedure point PK11_PubDerive could not be located in the dynamic link library nss3.dll'. I click on the OK button, and then Firefox load without any other side effects. But this becomes quite annoying and I would not get an error message to me. I tried to uninstall Firefox (all the same when I search for it, nothing comes up) and re-install. But the message is still there. I'm lost for what to do to get rid of him. Any help would be great!

    Thank you!

    BlindingFog said

    I use windows 7 and Firefox 39.0. Recently, when I open Firefox it gives this error, 'the entrance of procedure point PK11_PubDerive could not be located in the dynamic link library nss3.dll'. I click on the OK button, and then Firefox load without any other side effects. But this becomes quite annoying and I would not get an error message to me. I tried to uninstall Firefox (all the same when I search for it, nothing comes up) and re-install. But the message is still there. I'm lost for what to do to get rid of him. Any help would be great!

    Thank you!

    I thought about it. I had Cyrstal Reports XI on my machine and when I uninstalled it the error disappeared.

Maybe you are looking for

  • would like some advice to charge the battery on y50 - y70

    Hello I've always wondered: what is the best way to charge a battery in order to obtain maximum life of it? I remember reading something in the computer user's manual, but the instructions were little foggy and nebulous to me. Basically, it is best t

  • How to create a photo album with ms office?

    How to create a photo album with ms office? I tried to use picasa, but I don't know how to make an album. I also want to add a text below.

  • Get Windows 2008 Standard FE?

    Hello One of our customers recently their RAID array fails and we need to reinstall the operating system. The system has a CoA OEM for Windows Server 2008 Standard FE (Foundation Edition), but we have not all discs. Given that FE is OEM, it's probabl

  • Awards for the first event of port-a-thon

    Someone had the e-mail confirmation that rewards will be delivered on games that are approved? I have more than 2 games approved, but I do not get a reward or a reward of device. I am worried because in the event of port-a-thon to say if a person can

  • Summary form validation error

    trying to access the Web site used on XP message to get now - can't find no validation element summary 'form analytical validation' make sure that element whose ID is entered in the html document - what is that mean and how do I do