How to get sql % number of dynamic sql code lines

Hello

In this procedure I'm inserting and updating using dynamic sql. Now I want to go back two more PARAMETERS, the parameter should be back the number of lines inserted and how updated by stmtas of UPDATE as well as an INSERT. I'm not able to do can help you on that?

CREATE OR REPLACE PROCEDURE Sp_Array_Test( PV_TGT_NAME   IN  VARCHAR2,
                                           PV_SRC_NAME   IN  VARCHAR2,
                                           PV_PK_COLS    IN  VARCHAR2,
                                           PN_ERR_CD     OUT NUMBER,
                                           PN_ERR_MSG    OUT VARCHAR2)
AS


TYPE ARR_TAB IS TABLE OF VARCHAR2(4000) INDEX BY BINARY_INTEGER;


--UTL_FP        UTL_FILE.FILE_TYPE;
LV_AN_



BLOCK   VARCHAR2(32767);
LN_CUR        BINARY_INTEGER := DBMS_SQL.OPEN_CURSOR;
LN_DESC       DBMS_SQL.DESC_TAB;
LN_COL_CNT    PLS_INTEGER := 0;
LV_SEL_UPD_STMT   VARCHAR2(4000);
LV_SEL_INS_STMT   VARCHAR2(4000);
ARR_INDX      NUMBER := 1;
LV_DATA_TYPE  VARCHAR2(8);
LN_FIND_FLAG  NUMBER := 0;
LN_TAB        ARR_TAB;
LV_COLS_ARR   ARR_TAB;
LV_ERR_MSG    VARCHAR2(500);




--PROCEDURE FILE_WRITE ( FH_IN     IN UTL_FILE.FILE_TYPE,
--                STRING_IN IN VARCHAR2 ) IS
--BEGIN
--   UTL_FILE.PUT_LINE(FH_IN,STRING_IN);
--   LV_AN_BLOCK := LV_AN_BLOCK||STRING_IN;
--EXCEPTION
--   WHEN OTHERS THEN
--      RAISE;
--END FILE_WRITE;




BEGIN


--   UTL_FP := UTL_FILE.FOPEN('TEST_DIR', 'TEST.sql', 'W');


    LV_SEL_UPD_STMT := 'SELECT A.'||REPLACE(PV_PK_COLS,',','||A.')||' PK_COLS , A.* , B.ROWID FROM '||PV_SRC_NAME||' A, '||PV_TGT_NAME||' B WHERE ';


    LV_SEL_INS_STMT := 'SELECT A.* FROM '||PV_SRC_NAME||' A WHERE NOT EXISTS (SELECT ''1'' FROM '||PV_TGT_NAME||' B WHERE ';


    LN_TAB(ARR_INDX) := 'DECLARE ';
    ARR_INDX := ARR_INDX + 1;


    LN_TAB(ARR_INDX) := 'CURSOR CUR_VIEW_UPD IS '||LV_SEL_UPD_STMT ;
    ARR_INDX := ARR_INDX + 1;




    SELECT SUBSTR(COLS,DECODE(RN,1,1,INSTR(COLS,',',1,RN-1)+1),DECODE(RN,1,INSTR(COLS,',',1,RN)-1,INSTR(COLS,',',1,RN)-INSTR(COLS,',',1,RN-1)-1))
BULK COLLECT INTO LV_COLS_ARR
      FROM ( SELECT RN, PV_PK_COLS||',' COLS
               FROM (SELECT ROWNUM RN
                       FROM ALL_OBJECTS
                      WHERE ROWNUM <= LENGTH(PV_PK_COLS)- LENGTH(REPLACE(PV_PK_COLS,','))+1)) ;
    FOR K IN 1 .. LV_COLS_ARR.COUNT LOOP
        LV_SEL_UPD_STMT     := LV_SEL_UPD_STMT||' A.'||LV_COLS_ARR(K)||' = ';
        LN_TAB(ARR_INDX) := ' A.'||LV_COLS_ARR(K)||' = ';
        LV_SEL_UPD_STMT     := LV_SEL_UPD_STMT||' B.'||LV_COLS_ARR(K) ||CASE WHEN K = LV_COLS_ARR.COUNT THEN NULL ELSE ' AND ' END;
        LN_TAB(ARR_INDX) := LN_TAB(ARR_INDX)||' B.'||LV_COLS_ARR(K) ||CASE WHEN K = LV_COLS_ARR.COUNT THEN ' ;' ELSE ' AND ' END;
        ARR_INDX := ARR_INDX + 1;
    END LOOP;


    LN_TAB(ARR_INDX) := 'CURSOR CUR_VIEW_INS IS '||LV_SEL_INS_STMT ;
    ARR_INDX := ARR_INDX + 1;


    FOR K IN 1 .. LV_COLS_ARR.COUNT LOOP
        LV_SEL_INS_STMT     := LV_SEL_INS_STMT||' A.'||LV_COLS_ARR(K)||' = ';
        LN_TAB(ARR_INDX) := ' A.'||LV_COLS_ARR(K)||' = ';
        LV_SEL_INS_STMT     := LV_SEL_INS_STMT||' B.'||LV_COLS_ARR(K) ||CASE WHEN K = LV_COLS_ARR.COUNT THEN NULL ELSE ' AND ' END;
        LN_TAB(ARR_INDX) := LN_TAB(ARR_INDX)||' B.'||LV_COLS_ARR(K) ||CASE WHEN K = LV_COLS_ARR.COUNT THEN ' );' ELSE ' AND ' END;
        ARR_INDX := ARR_INDX + 1;
    END LOOP;




    LV_ERR_MSG := 'WHILE PARSING SELECT STATEMENT -- '||LV_SEL_UPD_STMT;
    DBMS_SQL.PARSE(LN_CUR, LV_SEL_UPD_STMT, DBMS_SQL.NATIVE);


    LV_ERR_MSG := 'WHILE DESCRIBING SELECT STATEMENT -- '||LV_SEL_UPD_STMT;
    DBMS_SQL.DESCRIBE_COLUMNS(LN_CUR, LN_COL_CNT, LN_DESC);






   FOR i IN LN_DESC.FIRST .. LN_DESC.LAST LOOP
      IF LN_DESC(i).col_type = 2 THEN
         LV_DATA_TYPE := 'NUMBER';
      ELSIF LN_DESC(i).col_type = 12 THEN
         LV_DATA_TYPE := 'DATE';
      ELSE
         LV_DATA_TYPE := 'VARCHAR2';
      END IF;
       LN_TAB(ARR_INDX) := '   T_'||LN_DESC(i).col_name||' DBMS_SQL.'||LV_DATA_TYPE||'_TABLE;';
       ARR_INDX := ARR_INDX + 1;
   END LOOP;






    LN_TAB(ARR_INDX) := 'BEGIN ';
    ARR_INDX := ARR_INDX + 1;
    LN_TAB(ARR_INDX) := '   EXECUTE IMMEDIATE ''ALTER SESSION SET NLS_DATE_FORMAT = ''''DD-MON-YYYY HH24:MI:SS'''''';';
    ARR_INDX := ARR_INDX + 1;
    LN_TAB(ARR_INDX) := '   OPEN CUR_VIEW_UPD;';
    ARR_INDX := ARR_INDX + 1;
    LN_TAB(ARR_INDX) := '   LOOP';
    ARR_INDX := ARR_INDX + 1;
    LN_TAB(ARR_INDX) := '      FETCH CUR_VIEW_UPD BULK COLLECT INTO T_'||LN_DESC(LN_DESC.FIRST).col_name||',';
    ARR_INDX := ARR_INDX + 1;
    FOR i IN LN_DESC.FIRST + 1 .. LN_DESC.LAST - 1 LOOP
      LN_TAB(ARR_INDX) := '                        T_'||LN_DESC(i).col_name||',';
      ARR_INDX := ARR_INDX + 1;
    END LOOP;
   LN_TAB(ARR_INDX) := '                        T_'||LN_DESC(LN_DESC.LAST).col_name||' LIMIT 500 ;';
   ARR_INDX := ARR_INDX + 1;
   LN_TAB(ARR_INDX) := '     FORALL I IN 1 .. '||'T_'||LN_DESC(LN_DESC.LAST).col_name||'.COUNT ';
   ARR_INDX := ARR_INDX + 1;
    LN_TAB(ARR_INDX) := '      UPDATE '||PV_TGT_NAME||' SET  ';
    ARR_INDX := ARR_INDX + 1;
    LN_FIND_FLAG := 0;
    FOR I IN LN_DESC.FIRST + 1 .. LN_DESC.LAST-1 LOOP
      FOR K IN 1 .. LV_COLS_ARR.COUNT LOOP
         LN_FIND_FLAG := 0;
         IF LN_DESC(I).COL_NAME = LV_COLS_ARR(K) THEN
            LN_FIND_FLAG := 1;
            EXIT;
         END IF;
      END LOOP;
      IF LN_FIND_FLAG = 0 THEN
        LN_TAB(ARR_INDX) := '                        '||LN_DESC(i).col_name||' = '||'T_'||LN_DESC(i).col_name||'(I)'||CASE WHEN I = LN_DESC.LAST-1 THEN ' WHERE ' ELSE ',' END;
        ARR_INDX := ARR_INDX + 1;
      END IF ;
    END LOOP;


   LN_TAB(ARR_INDX) := '                        ROWID = '||'T_'||LN_DESC(LN_DESC.LAST).col_name||'(I) ;';
   ARR_INDX := ARR_INDX + 1;


   LN_TAB(ARR_INDX) := '      COMMIT;';
   ARR_INDX := ARR_INDX + 1;


   LN_TAB(ARR_INDX) := '      EXIT WHEN CUR_VIEW_UPD%NOTFOUND;';
   ARR_INDX := ARR_INDX + 1;


   LN_TAB(ARR_INDX) := '   END LOOP;';
   ARR_INDX := ARR_INDX + 1;


   LN_TAB(ARR_INDX) := '   CLOSE CUR_VIEW_UPD;';
   ARR_INDX := ARR_INDX + 1;


   LN_TAB(ARR_INDX) := '      COMMIT;';
   ARR_INDX := ARR_INDX + 1;




    LN_TAB(ARR_INDX) := '   OPEN CUR_VIEW_INS;';
    ARR_INDX := ARR_INDX + 1;
    LN_TAB(ARR_INDX) := '   LOOP';
    ARR_INDX := ARR_INDX + 1;
    LN_TAB(ARR_INDX) := '      FETCH CUR_VIEW_INS BULK COLLECT INTO T_'||LN_DESC(LN_DESC.FIRST+1).col_name||',';
    ARR_INDX := ARR_INDX + 1;
    FOR i IN LN_DESC.FIRST + 2 .. LN_DESC.LAST - 2 LOOP
      LN_TAB(ARR_INDX) := '                        T_'||LN_DESC(i).col_name||',';
      ARR_INDX := ARR_INDX + 1;
    END LOOP;
   LN_TAB(ARR_INDX) := '                        T_'||LN_DESC(LN_DESC.LAST-1).col_name||' LIMIT 500 ;';
   ARR_INDX := ARR_INDX + 1;


   LN_TAB(ARR_INDX) := '     FORALL J IN 1 .. '||'T_'||LN_DESC(LN_DESC.FIRST + 1).col_name||'.COUNT ';
   ARR_INDX := ARR_INDX + 1;
   LN_TAB(ARR_INDX) := '     INSERT INTO '||PV_TGT_NAME||' (';
   ARR_INDX := ARR_INDX + 1;
    FOR i IN LN_DESC.FIRST + 1 .. LN_DESC.LAST - 1 LOOP
      LN_TAB(ARR_INDX) := '                        '||LN_DESC(i).col_name||CASE WHEN I = LN_DESC.LAST - 1  THEN ' )' ELSE ',' END ;
      ARR_INDX := ARR_INDX + 1;
    END LOOP;
    FOR i IN LN_DESC.FIRST + 1 .. LN_DESC.LAST - 1 LOOP
      LN_TAB(ARR_INDX) := CASE WHEN I = LN_DESC.FIRST + 1 THEN 'VALUES (' ELSE NULL END ||'                        T_'||LN_DESC(i).col_name||'(J)'||CASE WHEN I = LN_DESC.LAST - 1  THEN ' ) ;' ELSE ',' END ;
      ARR_INDX := ARR_INDX + 1;
    END LOOP;


   LN_TAB(ARR_INDX) := '      COMMIT;';
   ARR_INDX := ARR_INDX + 1;


   LN_TAB(ARR_INDX) := '      EXIT WHEN CUR_VIEW_INS%NOTFOUND;';
   ARR_INDX := ARR_INDX + 1;


   LN_TAB(ARR_INDX) := '   END LOOP;';
   ARR_INDX := ARR_INDX + 1;


   LN_TAB(ARR_INDX) := '   CLOSE CUR_VIEW_INS;';
   ARR_INDX := ARR_INDX + 1;


   LN_TAB(ARR_INDX) := '      COMMIT;';
   ARR_INDX := ARR_INDX + 1;


   LN_TAB(ARR_INDX) := 'END ;';
   ARR_INDX := ARR_INDX + 1;




   FOR J IN 1 .. LN_TAB.COUNT LOOP
--     DBMS_OUTPUT.PUT_LINE( LN_TAB(J));
--     FILE_WRITE(UTL_FP,LN_TAB(J));
     LV_AN_BLOCK := LV_AN_BLOCK||LN_TAB(J);
   END LOOP;


--   UTL_FILE.FCLOSE(UTL_FP);


   EXECUTE IMMEDIATE LV_AN_BLOCK;


PN_ERR_CD    := 0;
PN_ERR_MSG   := 'Successful Completion';


EXCEPTION
WHEN OTHERS THEN
PN_ERR_CD    := SQLCODE;
PN_ERR_MSG   := LV_ERR_MSG||' -- '||SQLERRM ;
END;
/

Thank you all for your answers. I agree with you all. I have manged this time by adding variable bind, then run it immediately ON aid. I don't know how it's going to be training.

From now on my side no problem I don't thank you.

Tags: Database

Similar Questions

  • How to get the number of delivery to the lines AR-Transaction?

    Hello

    We try to develop a personalized Transactions AR Invoice output (12.0.5). What our goal is to get delivery number of screen of Transactions at the level of the line. We want to offer it, because our client wants to show number of delivery at the exit of Bill...

    How can we make this?

    I'll be very grateful for any help

    Thanks in advance...


    Cagri

    When the order line is invoiced, delivery number is stored in the interface_line_attribute3 in the ra_customer_trx_lines_all table.

    Thank you
    Claire

  • How to get the number of fonts online

    Hi all

    can you give me solution to the following:

    How to get the number of fonts on a line.

    Ex

    BlackBerry Support 'Community' is supported for my career

    in this line, I want to ITALIC for the word 'Community '.

    Font.GetDefault (). Derive from wil give for total line...

    RichTextField does not?

    See this KB article

    http://supportforums.BlackBerry.com/T5/Java-development/format-text-in-a-RichTextField/Ta-p/445038

  • How to get serial number in Dell monitor?

    Hello

    How to get serial number in Dell Monitor (model No.: S2240Lc).

    I have only 20-digit S/n.

    Thank you

    Riou...

    As I said, you can't get a service tag. By the article.

    Monitors without a number of service purchased from resellers (Amazon, Best Buy, Buy.com, cost Co, Wal-Mart, Sams, other boutique online, etc.)
    * Based on the start date of date code monitor 20-digit serial number, Dell PPID you monitor for 3 years warranty
    You need to contact Support for your country. Tell them to open the Dell internal only Oracle knowledge Information center
    * In the search space, they should enter PNP13081, and then click search. This opens the article =
    Replacement for Dell monitor and procedure - Dell international policy policy

    The customer is unable to provide a Dell order number or serial number system because the customer bought the monitor from a retailer. The only information that the client has are the PPID number for the monitor. For monitors when there is not an available Dell order number, agents will use the date code embedded in the PPID monitor serial number to determine the beginning of the start of coverage.

    Discussion = the warranty is 3 years from the date of early series PPID embarked on the label.
    Solution = Set up screen replacement against the fake tag.
    * You would provide the following representative data if you need a replacement monitor in this 3-year period:
    Brick or shop online:
    Monitor model:
    Monitor 20 digits alphanumeric serial number PPID:
    [Your]
    E-mail address:
    Name:
    Shipping address:
    Phone number:
    Operating system:
    Video card:
    Video card ports tested:
    Question:
    Performed troubleshooting:
    Monitor the done Factory Reset
    Watch chess self-test Diagnostics and integrated
    * Post more troubleshooting

  • I have a thinkstation with win7pro an OEM installed how to get serial number

    I have a thinkstation with win7pro an OEM installed how to get serial number

    If it's a win7 machine, there should be a sticker.  It is called the product key and is 25 alphanumeric characters in 5 sets of 5.

  • How to get the number of entries in the navigation menu?

    boc.bmp

    How to get the number of entries in the navigation menu? Check the image. What it shows 8 number of customers and 10 products and 10 orders in the list. How to get it?

    --

    Thank you

    Hello

    Create items of the request saying, "CUSTOMERS", "PRODUCTS" and "ORDERS".

    Create the application process that defines these items when loading the page for example

    C1 in select count (*) NTC (of customer_table)

    loop

    : CUSTOMERS: = c1.cnt;

    end loop;

    C1 in select count (*) NTC (of products_table)

    loop

    PRODUCTS: = c1.cnt;

    end loop;

    C1 in select count (*) NTC (of orders_table)

    loop

    : ORDERS: = c1.cnt;

    end loop;

    Components shared Open-> Navigation bar and change:

    In the entry list Label-> customers & CLIENTS.]

  • How to get SQL that do not use bind variables

    Hello

    I am trying to identify the SQL code which should benefit from the use of bind variables.
    First of all, I tried to get the common signature of all the sql calls, using:
    select * from (
    select  force_matching_signature, count(1) from v$sql where force_matching_signature<>0 group by force_matching_signature order by 2 desc
    ) where rownum < 50;
    Then I copied these values to the Clipboard and run:
    select sql_text from v$sql where force_matching_signature=<<<copied_signature_value>>>;
    Now, I want to make it automatically and get only 1 occurrence of each SQL that resembles others by using a query.

    I tried this:
    select sql_text from
    (
    select sql_text, force_matching_signature, row_number() over (partition by force_matching_signature order by sql_text desc)rn from v$sql where force_matching_signature <>0
    )where rn <2 and rownum < 10 order by force_matching_signature desc
    But it is not returning results by showing up at the count (1) from the first query, I've used. How can I change this if I get the results in order of "importance"?




    Thank you

    And I said. First use the command by then use rownum. I did not mention row_number. Also, there should be no need to add more columns.
    Have you tried it? Why it did not work?

    example not tested

    select * from (
       select sql_text from (select sql_text, force_matching_signature, row_number() over (partition by force_matching_signature order by sql_text desc) rn from v$sql where force_matching_signature != 0)
       where rn = 1
       order by force_matching_signature desc /* add any ordering you like here */
       )
    where rownum < 10  /* then filter on the first 10 results */
    

    If you want to order that the statement that found most of the time comes first, say so. However, I don't see how to group in your case.
    Maybe like this

    example of tested

    select * from (
       select cnt, sql_text
       from (select sql_text, force_matching_signature, row_number() over (partition by force_matching_signature order by sql_text desc) rn , count(*) over (partition by force_matching_signature) cnt
             from v$sql
             where force_matching_signature != 0)
       where rn = 1
       order by cnt desc, force_matching_signature desc /* add any ordering you like here */
       )
    where rownum < 10  /* then filter on the first 10 results */
    ;
    

    Published by: Sven w. October 11, 2012 14:49

    Published by: Sven w. October 11, 2012 14:51

    Published by: Sven w. on October 11, 2012 14:56 - number column added to the output

  • How to get SQL * more to connect to my database of Apex?

    How can I get SQL * more to connect to my database of Apex? By using the username and password I use to connect to Apex does not (ORA-01017). What should I do to connect to my db Apex?

    Thank you
    Kim

    Connection string is "connect username/password@database".

    The analysis schema is a database account, that's why you can log on to SQL * more like that.

    This allows to get the database name

    select instance_name from v$instance;
    

    And if you forgot the password for the PT

    alter user PT identified by 'your_new_password';
    

    Scott

  • How to get the number in the format "999,999,999.000" in oracle

    Hi friends,
    How can I get the number entered in the format '999,999,999.000 '...
    for example, if my number has 1900, it should give 1,900.000
    If my number is 10000, then it should give me 10,000.000 like this in sql
    is there a function available for this?

    pls help

    Thank you

    Hello

    Check below hope it solves your problem.

    SQL> SELECT TRIM(TO_CHAR(1900, '999,999,999,999,999.99')) FROM DUAL;
    
    TRIM(TO_CHAR(1900,'999,999,999
    ------------------------------
    1,900.00
    SQL> SELECT TRIM(TO_CHAR(10000, '999,999,999,999,999.99')) FROM DUAL;
    
    TRIM(TO_CHAR(10000,'999,999,99
    ------------------------------
    10,000.00
    
    SQL> 
    

    Concerning
    Ameya

  • How to get the number of lines in a region of report

    Hi all

    Is there a way to get the number of rows returned in a report region, without issuing an another 'select count (*) from une_table?
    I mean something like the substitution string #ROW_NUM # but for the total of the lines.

    Thank you

    Pedro.

    http://download.Oracle.com/docs/CD/E17556_01/doc/user.40/e15517/UI.htm#CHDDGGEG

    For parts of classic report, the footer region supports the following substitution strings:

    #ROWS_FETCHED # indicates the number of lines read by the reporting engine Oracle Application Express (the size of the page). You can use these substitution strings to display messages to the user. For example:

    Read #ROWS_FETCHED # #TIMING # seconds lines.

    * #TOTAL_ROWS # displays the total number of rows that satisfy an SQL query used for a report.

    #FIRST_ROW_FETCHED # and #LAST_ROW_FETCHED # show the range of displayed lines. For example:

    Until #FIRST_ROW_FETCHED # by #LAST_ROW_FETCHED # of #ROWS_FETCHED # displayed >

    Van
    Trent

  • How to get the number of bits of Windows?

    Hi all

    How can I get the number of bits of Windows, the application of the LV is running on?

    By using the disabled conditional structure, I can get the number of bits of the application (if it is built in BT 32 or 64), but not the number of bits of windows.

    Thank you

    system variable 'PROCESSOR_ARCHITECTURE '?

  • How to get the number of line of a multi-line string

    It seems that this Panel of string does not provide the tool to get the chain line number,

    Does anyone have the same experience?

    so...

    How to get the line number of a variable string?

    Number of lines

  • How to get the number and the name of the contacts selector

    Hi all

    I got the Contact Picker work but I have no idea how to get the selected telephone number and the name.

    There are attributes that I can put like contactId.value () to retrieve or there is another way?

    Thanks in advance.

    ImageButton{
                        defaultImageSource: "asset:///images/bluebutton.png"
                        onClicked: {
                            contactPicker.open();
                        }
                        attachedObjects: [
                            ContactPicker {
                                id: contactPicker
                                onContactSelected: {
                                    result.text = "You chose contact: " + contactId;
                                }
                            }
                        ]
    
                    }
    
                    Label {
                        id: result
                        text: "You chose contact: "
                    }
    

    Hello

    You can get the contact name and phone number as this,

    ImageButton{
                        defaultImageSource: "asset:///images/bluebutton.png"
                        onClicked: {
                            contactPicker.open();
                        }
                        attachedObjects: [
                            ContactPicker {
                                id: contactPicker
                                onContactSelected: {
                                    result.text = "You chose contact: " + contactId;
    // call a cpp method to get the details
    
    app.getDetails(contactId); } } ] } Label { id: result text: "You chose contact: " }
    

    the CPP code:

    void ContactDetails(ContactId id)
    {
    Contact contact_info = m_contactService->contactDetails(id);
    
        QString firstName = contact_info.firstName();
        QString lastname = contact_info.lastName();
            QList phoneno_list = contact_info.phoneNumbers();
    
        QStringList no_s;
    
        foreach(ContactAttribute attr, phoneno_list)
        {
            no_s << attr.value();
        }
    }
    

    You can get details like this.

    Kind regards

    Naresh Kodumuri.

  • How to get a year back dynamically in Oracle?

    Hello experts,

    I try to create partitions on a table and would go back up to the year last to create partitions. I am currently hardcode values. I want to configure it dynamically based on SYSDATE. Someone here could help me please?

    CREATE TABLE PRDT_SALES 
       (SALES_ID NUMBER NOT NULL ENABLE, 
       PRDT_NM VARCHAR2(50 CHAR) NOT NULL ENABLE, 
       SALE_START TIMESTAMP (6), 
       SALE_END TIMESTAMP (6), 
       PRDT_TYPE VARCHAR2(50 CHAR), 
       PRDT_NM VARCHAR2(50 CHAR), 
       PRDT_CODE VARCHAR2(50 CHAR), 
       PRDT_DESC VARCHAR2(50 CHAR), 
       SALE_DT DATE NOT NULL ENABLE, 
       SALE_UPDT_TS TIMESTAMP (6) DEFAULT SYSTIMESTAMP NOT NULL ENABLE
       )
    PARTITION BY RANGE (SALE_DT)
     (PARTITION P20131001 VALUES LESS THAN (TO_DATE('2013-10-02 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) );
    

    Later, I am running this script.

    DECLARE
       c_start_dt   DATE := TO_DATE ('11-NOV-2013') ;
       c_end_dt     DATE := TO_DATE ('11-NOV-2014');
    BEGIN
       FOR dt_rec IN (SELECT 'P' || TO_CHAR (dt, 'YYYYMMDD') AS part_nm,
                             dt + 1 AS part_dt
                        FROM (SELECT c_start_dt - 1 + ROWNUM AS dt
                                FROM all_objects
                               WHERE c_start_dt - 1 + ROWNUM <= c_end_dt
                             )
                       ORDER BY dt
                     )
       LOOP
           EXECUTE IMMEDIATE 'ALTER TABLE prdt_sales' ||
                             ' ADD PARTITION ' || dt_rec.part_nm ||
                        ' VALUES LESS THAN (TO_DATE(' || '''' || TO_CHAR (dt_rec.part_dt, 'DD-MON-YYYY') || '''' || ',' || '''' || 'DD-MON-YYYY' || '''' || '))';
       END LOOP;
    END;
    /
    

    I would like to know how to make the c_start_dt and dynamic c_end_dt based on SYSDATE.

    Thank you

    Julaayi

    Thank you. This helped.

    Just to clarify, we need to declare it as date.

    c_start_dt DATE: = trunc ((sysdate-12) add_months);

    c_end_dt DATE: = trunc (sysdate);

  • How to get IMEI number with phonegap app by using Javascript?

    Hello

    I suffer on this the last 2 days to get the IMEI number in phonegap app by using javascript.

    I found all things related to Phonegap with Android, but I want to get the IMEI number with phonegap app by using javascript/JQuery according to requirement.

    Could you please give me the process step by step to get the IMEI number with phonegap app with javascript/JQuery?

    Thanks in advance.

    Thank you

    Jayaram

    You can use the cordova-plugin-device plugin for a UUID of the device (this api is the same on iOS, Android,...)

    This isn't exactly the same as the IMEI, but it is unique enough to identify the device, while protecting the privacy of the owner of the phone.

    If you need to get the IMEI, then google is your friend. This [1] was the first result when searching for "imei cordova.

    There's a good stack overflow article here [2] which has the disadvantage of using this value and encourage you to consider other ways to identify users, because users cannot trust your application if you ask for this info. Read the accepted answer.

    [1] GitHub - aquto/cordova-plugin-imei

    [2] http://stackoverflow.com/questions/1972381/how-to-get-the-devices-imei-esn-programmaticall y-android

  • VMware View | PowerCLI | How to get the number of virtual machine in a specific pool-ID

    Hello

    Generally, to get the number of VMS in a pool, I run this command:

    Get-pool | Select Pool_id, @{Name = "NumVM"; Expression = {($_ |)} (Get - DesktopVM). County}} | out-gridview

    But how can I list all the pools and then select the pool I want a county of?

    Maybe something like:

    Select 1 for accounts

    Select 2 for Marketing

    and then County VM just for this pool and immediate where at the output (Out-gridview or Export-CSV)

    Thanks, Julien

    Hi LucD

    I don't understand the line:

    1.. $pools. County | %{
    Write-Host "$_" $Pools [$_ - 1]. Name

    Why do we need the 1...

    Also is the same as get-get-resourcepool pool?

    Thanks, Julien

Maybe you are looking for

  • Cannot connect to phone

    So, I can connect to the Web site on my computer and the phone, but I can't log in to the App (by username). I use the same exact references, that I use on the Web site to try to connect. I uninstalled and reinstalled the application. I changed my pa

  • Satellite L300 warms up very quickly

    HelloMy Toshiba satellite L300 warms very quickly, I've had this laptop for about 2 years (2008-05-26). Recently, it's warmer and off, which happened twice.I was wondering if it is a danger or anything I should look out for.Thanks :)

  • E540 Touchpad Government only right click, left click cannot

    Hello community, I recently purchase a Lenovo ThinkPad Edge 540 and it worked very well until early today (bought around mid-June).While I was browsing the internet, some how my touchpad developed a problem.TI only Government right click when ever I

  • How do you properly remove and reinstall the hp 3210xi printer software in Vista after a bad installation?

    It is a repost to seek expert assistance from HP last week. Product: hp 3210xi printer. Operating system: Vista 64-bit. Errors: Several, especially related to the missing .msi TrayApp, status and DocProc files.  Some of them are on other Windows logo

  • This is not a genuine Microsoft product?

    I get the message that this is not a genuine Microsoft product on my computer. I had for 3 years and have had no problem. What is c?