11gR2 SELECT statement: new syntax for specifying partition key

I have an Oracle 11gR2 table which is interval partitioned on a single NUMBER column.
I am trying to query a single partition using the new SELECT ... FOR ( < partition key> ) syntax.
I keep getting an ORA-00905 error as follows, any ideas what I am doing wrong?
SQL*Plus: Release 11.2.0.2.0 Production on Wed Dec 12 10:34:36 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select * from rpt_dif_daily_instance_fact for ( 41215 )
2 /
select * from rpt_dif_daily_instance_fact for ( 41215 )
ERROR at line 1:
ORA-00905: missing keyword
SQL> show sqlpluscompatibility
sqlpluscompatibility 11.2.0

Welcome to the forum!
Thanks for providing your 4 digit Oracle version. You should always do that when you post since functionality may be different between versions.
>
I have an Oracle 11gR2 table which is interval partitioned on a single NUMBER column.
I am trying to query a single partition using the new SELECT ... FOR ( < partition key> ) syntax.
I keep getting an ORA-00905 error as follows, any ideas what I am doing wrong?
SQL*Plus: Release 11.2.0.2.0 Production on Wed Dec 12 10:34:36 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select * from rpt_dif_daily_instance_fact for ( 41215 )
2 /
select * from rpt_dif_daily_instance_fact for ( 41215 )
ERROR at line 1:
ORA-00905: missing keyword
>
As bencol said you are not using the new syntax. See the SQL Language doc 'partition_extension_clause' for the syntax diagram that shows the syntax options.
http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_10002.htm
If you provide the partition name then the syntax is
. . .PARTITION (partition)If you provide a partition key value the syntax is
. . .PARTITION FOR (partition_key_value)

Similar Messages

  • All rows in table do not qualify for specified partition

    SQL> Alter Table ABC
    2 Exchange Partition P1 With Table XYZ;
    Table altered.
    SQL> Alter Table ABC
    2 Exchange Partition P2 With Table XYZ;
    Exchange Partition P2 With Table XYZ
    ERROR at line 2:
    ORA-14099: all rows in table do not qualify for specified partition
    The exchange partition works correct for the first time. However if we try to exchange 2nd partition it gives the error.
    How do i solve this error?
    How do i find rows which are not qualified for the specified portion. is there a query to find out the same?

    stephen.b.fernandes wrote:
    Is there another way?First of all, exchange is physical operation. It is not possible to append exchanged data. So solution would be to create archive table as partitioned and use non-partitioned intermediate table for exchange:
    SQL> create table FLX_TIME1
      2  (
      3  ACCOUNT_CODE VARCHAR2(50) not null,
      4  POSTING_DATE DATE not null
      5  ) partition by range(POSTING_DATE) INTERVAL(NUMTOYMINTERVAL(1, 'MONTH'))
      6  ( partition day0 values less than (TO_DATE('01-12-2012', 'DD-MM-YYYY') ) )
      7  /
    Table created.
    SQL> create index FLX_TIME1_N1 on FLX_TIME1 (POSTING_DATE)
      2  /
    Index created.
    SQL> create table FLX_TIME1_ARCHIVE
      2  (
      3  ACCOUNT_CODE VARCHAR2(50) not null,
      4  POSTING_DATE DATE not null
      5  ) partition by range(POSTING_DATE) INTERVAL(NUMTOYMINTERVAL(1, 'MONTH'))
      6  ( partition day0 values less than (TO_DATE('01-12-2012', 'DD-MM-YYYY') ) )
      7  /
    Table created.
    SQL> create table FLX_TIME2
      2  (
      3  ACCOUNT_CODE VARCHAR2(50) not null,
      4  POSTING_DATE DATE not null
      5  )
      6  /
    Table created.
    SQL> Declare
      2  days Number;
      3  Begin
      4  FOR days IN 1..50
      5  Loop
      6  insert into FLX_TIME1 values (days,sysdate+days);
      7  End Loop;
      8  commit;
      9  END;
    10  /
    PL/SQL procedure successfully completed.
    SQL> set linesize 132
    SQL> select partition_name,high_value from user_tab_partitions where table_name='FLX_TIME1';
    PARTITION_NAME                 HIGH_VALUE
    DAY0                           TO_DATE(' 2012-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
    SYS_P119                       TO_DATE(' 2013-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
    SYS_P120                       TO_DATE(' 2013-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
    Now we need to echange partition SYS_P119 to FLX_TIME2 and then echange FLX_TIME2 into FLX_TIME1_ARCHIVE:
    To exchange it with FLX_TIME2:
    SQL> truncate table FLX_TIME2;
    Table truncated.
    SQL> alter table FLX_TIME1 exchange partition SYS_P119 with table FLX_TIME2;
    Table altered.To exchange FLX_TIME2 with FLX_TIME1_ARCHIVE we need to create corresponding partition in FLX_TIME1_ARCHIVE. To do than we use LOCK TABLE PARTITION FOR syntax supplying proper date value HIGH_VALUE - 1 (partition partitioning column is less than HIGH_VALUE so we subtract 1) and then use ALTER TABLE EXCHANGE PARTITION FOR syntax:
    SQL> lock table FLX_TIME1_ARCHIVE
      2    partition for(TO_DATE(' 2013-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN') - 1)
      3    in share mode;
    Table(s) Locked.
    SQL> alter table FLX_TIME1_ARCHIVE exchange partition
      2    for(TO_DATE(' 2013-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN') - 1)
      3    with table FLX_TIME2;
    Table altered.
    SQL> Same way we exchange partition SYS_P120:
    SQL> truncate table FLX_TIME2;
    Table truncated.
    SQL> alter table FLX_TIME1 exchange partition SYS_P120 with table FLX_TIME2;
    Table altered.
    SQL> lock table FLX_TIME1_ARCHIVE
      2    partition for(TO_DATE(' 2013-01-02 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN') - 1)
      3    in share mode;
    Table(s) Locked.
    SQL> alter table FLX_TIME1_ARCHIVE exchange partition
      2    for(TO_DATE(' 2013-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN') - 1)
      3    with table FLX_TIME2;
    Table altered.
    SQL> Now:
    SQL> select  count(*)
      2    from  FLX_TIME1 partition(day0)
      3  /
      COUNT(*)
             8
    SQL> select  count(*)
      2    from  FLX_TIME1 partition(sys_p119)
      3  /
      COUNT(*)
             0
    SQL> select  count(*)
      2    from  FLX_TIME1 partition(sys_p120)
      3  /
      COUNT(*)
             0
    SQL> select partition_name from user_tab_partitions where table_name='FLX_TIME1_ARCHIVE';
    PARTITION_NAME
    DAY0
    SYS_P121
    SYS_P122
    SQL> select  count(*)
      2    from  FLX_TIME1_ARCHIVE partition(day0)
      3  /
      COUNT(*)
             0
    SQL> select  count(*)
      2    from  FLX_TIME1_ARCHIVE partition(sys_p121)
      3  /
      COUNT(*)
            31
    SQL> select  count(*)
      2    from  FLX_TIME1_ARCHIVE partition(sys_p122)
      3  /
      COUNT(*)
            11
    SQL> SY.

  • New syntaxes for Obsolete ones

    Can anyone tell me the new syntaxes for these-
    1) Using 'occurs' for creating an internal table is obsolete now.
    2) Move statement is obsolete. For a unicode upgrade what is the solution for these?
    Search before posting further
    Edited by: Vijay Babu Dudla on Jan 15, 2009 4:28 AM

    Hai,
    TYPes: begin of ty_tab,
               f1 type element,
              f2 type element2,
    end of ty_tab.
    types: ty_it_tab type table of ty_tab.
    data: it_table type ty_it_tab.
    data: wa type ty_tab.
    Use explicit work areas for the internal tables. you can also use field-symbols if required.
    Regards,
    Venkatesh

  • How build where clause in select statement in FM for Virtual provider

    Hi
    I looking for example of FM for Virtual provider where I find code how assign to select statement "where" clause value from query variable.
    In following code how build t_r_custtype range and how assign value to it.
    CODE********************************
    TYPE-POOLS: abap.
    initialize
      CLEAR: e_t_data, e_t_msg.
    this is specific to infoprovider VIRTPROV
      CHECK i_infoprov = 'VIRTPROV'.
      FIELD-SYMBOLS: <l_s_sbook> TYPE sbook,
                     <l_s_data>  TYPE ANY.
      DATA: l_t_component TYPE abap_compdescr_tab,
            l_t_sbook     TYPE TABLE OF sbook.
    initialize
      CLEAR e_t_data.
    Data selection / only Business Customer
      SELECT * FROM sbook
        INTO CORRESPONDING FIELDS OF TABLE l_t_sbook
        WHERE custtype in t_r_custtype.
    ENDCODE********************************
    Thanks a lot
    Adam

    Hello,
    Would you like fill the ranges in Customer exit for BEx..? 
    If Yes. please refer the attachment for the whole code...
    "Sample code in Customer Exit in BEx"
    IF i_step = 2.
    CASE i_vnam.
    WHEN 'ZDAY_CX'.
    LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZDAY_IN'.
    CLEAR: l_s_range.
    ZT_DT1 = loc_var_range-low.
    ZT_DT2 = loc_var_range-HIGH.
    CALL FUNCTION 'DATE_CREATE'
    EXPORTING
    ANZAHL_JAHRE = 0
    ANZAHL_KALTAGE = 0
    ANZAHL_MONATE = '-1'
    ANZAHL_TAGE = 0
    DATUM_EIN = ZT_DT1
    DATUM_EIN_ULT = ' '
    ULTIMO_SETZEN = ' '
    IMPORTING
    DATUM_AUS = ZFIDAY .
    E_TT =
    E_ULTKZ =
    CALL FUNCTION 'DATE_CREATE'
    EXPORTING
    ANZAHL_JAHRE = 0
    ANZAHL_KALTAGE = 0
    ANZAHL_MONATE = '-1'
    ANZAHL_TAGE = 0
    DATUM_EIN = ZT_DT2
    DATUM_EIN_ULT = ' '
    ULTIMO_SETZEN = ' '
    IMPORTING
    DATUM_AUS = ZLSDAY.
    E_TT =
    E_ULTKZ =
    l_s_range-low = ZFIDAY .
    l_s_range-high = ZLSDAY .
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    APPEND l_s_range TO e_t_range.
    ENDLOOP.
    *****************************************End*************************************
    **To get the From date (For Text Variable) as per the user input date interval range**
    WHEN 'ZR_S'.
    LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZDAY_IN'.
    CLEAR: l_s_range.
    ZT_DT1 = loc_var_range-low.
    ZT_DT2 = loc_var_range-HIGH.
    CALL FUNCTION 'DATE_CREATE'
    EXPORTING
    ANZAHL_JAHRE = 0
    ANZAHL_KALTAGE = 0
    ANZAHL_MONATE = 0
    ANZAHL_TAGE = 0
    DATUM_EIN = ZT_DT1
    DATUM_EIN_ULT = ' '
    ULTIMO_SETZEN = ' '
    IMPORTING
    DATUM_AUS = ZFIDAY .
    E_TT =
    E_ULTKZ =
    l_s_range-low0(2) = ZFIDAY6(2).
    l_s_range-low+2(1) = '.'.
    l_s_range-low3(2) = ZFIDAY4(2).
    l_s_range-low+5(1) ='.'.
    l_s_range-low6(4) = ZFIDAY0(4).
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    APPEND l_s_range TO e_t_range.
    ENDLOOP.
    *****************************************End*************************************
    Please let me know if any clarification required..
    Rinku..

  • New syntax for Go URL in Analytics 10.1.3.2 onwards

    Can someone please share the location of any documentation for parameter passing in version 10.3.4.1 ?
    Specifically, I am having difficulty getting the BETWEEN qualifier to function as expected: *&op1=bet*
    Almost all of the GO URL examples that reference the new variable passing style simply use *&col1=* and *&val1=* and leave off the optional operator, letting it default to *&op1=eq*. Filtering for a single date using &op1=eq, &op1=gt, &op1=le works just fine. But when I try to overload the new &val1= pararameter the same method that the older syntax uses
    &P3=2+"8/12/2012 12:00:00 AM"+"08/18/2012 12:00:00 AM"
    &val1=2+"8/12/2012 12:00:00 AM"+"08/18/2012 12:00:00 AM" or any variant of date/time then it fails.
    I need to be able to filter for a specific range of dates and tried every combination of escaped sequences that I can think of with no success.
    Thanks in advance for any suggestions or links,
    -Marco
    (Dallas, TX)

    Thanks, I have the docs for the older &P0, &P1-P3, &P4-P6, etc. structure. I prefer the newer and cleaner format of the &col1= and &val1=, especially given the fact that there isn't a limit on the number of filters, the old approach cannot have more than 6 conditions.
    I really don't want to have to code for both formats since I already have a lot of queries built using the newer syntax. Surely, Oracle still supports the BETWEEN operator.

  • Select statement (new to ABAP)

    Hi, I just get to know ABAP and have been studying about it. I'm practising an exercise in which i use select statement to retrieve data from many tables with the same field. The tables i use are COSS, AFVC, PRPS and IMZO with the same field OBJNR. The data i need to retrieve is POSNR from table IMZO. This is the code that i've just written. Howvever, when i execute it, it said 'Unable to interpret t_imobj-posnr'. I think the code is not right somehow. Very appreciate any guides.
    REPORT  Z_IMPOS_TEST.
    TABLES: coss,       "CO Object: Cost Totals for Internal Postings
            afvc,       "Operation within an order
            prps,       "WBS (Work Breakdown Structure) Element Master Data
            imzo.       "Table: CO Object - Capital Investment Prog.Pos.
    TYPES: BEGIN OF st_impos,
      objnr       TYPE coss-objnr,
      gjahr       TYPE coss-gjahr,
      pspnr       TYPE prps-pspnr,
      posnr       TYPE imzo-posnr,
    END OF st_impos.
    DATA : st_imobj    TYPE st_impos,
           t_imobj     TYPE STANDARD TABLE OF st_impos.
    *PARAMETERS: p_year TYPE coss-gjahr OBLIGATORY.
    SELECT objnr gjahr
          INTO CORRESPONDING FIELDS OF st_imobj
          FROM  coss
          WHERE objnr = st_imobj-objnr
          AND  gjahr = '2007'.
       SELECT objnr
          INTO st_imobj-objnr
          FROM afvc
          WHERE projn = st_imobj-pspnr.
             SELECT objnr
             INTO st_imobj-objnr
             FROM imzo
             WHERE posnr = st_imobj-posnr.
             st_imobj-posnr = st_imobj-posnr.
             st_imobj-gjahr = '2007'.
             APPEND st_imobj TO t_imobj.
             ENDSELECT.
        ENDSELECT.
      ENDSELECT.
      WRITE: 'InvProgPosition is : '  t_imobj-posnr.

    thank you everyone. I fixed most of the lines in the code. The syntac is correct now, but since i used nested select statements, it takes like FOREVER to give the output when i execute it!. Are there any other ways to make the code more effecient?
    REPORT  z_impos_test.
    TABLES: coss,       "CO Object: Cost Totals for Internal Postings
            afvc,       "Operation within an order
            prps,       "WBS (Work Breakdown Structure) Element Master Data
            imzo.       "Table: CO Object - Capital Investment Prog.Pos.
    TYPES: BEGIN OF st_impos,
      objnr       TYPE coss-objnr,
      gjahr       TYPE coss-gjahr,
      kstar       type coss-kstar,
      projn       type afvc-projn,
      pspnr       type prps-pspnr,
      posnr       type imzo-posnr,
    END OF st_impos.
    data: year TYPE coss-gjahr value '2007'.
    DATA: t_output  TYPE STANDARD TABLE OF st_impos WITH HEADER LINE,
          st_output TYPE st_impos,
          t_output2 TYPE STANDARD TABLE OF st_impos WITH HEADER LINE,
          st_output2 TYPE st_impos.
    SELECT objnr gjahr kstar FROM coss
    INTO CORRESPONDING FIELDS OF st_output
    WHERE ( objnr LIKE 'NV%' OR
          objnr LIKE 'PR%' ) AND
           gjahr = year.
       SELECT SINGLE projn from afvc into CORRESPONDING FIELDS OF st_output
           WHERE objnr = st_output-objnr.
    APPEND st_output to t_output.
    ENDSELECT.
    SORT t_output BY objnr.
    DELETE ADJACENT DUPLICATES FROM t_output.
    LOOP AT t_output into st_output.
    SELECT objnr pspnr
           INTO CORRESPONDING FIELDS OF st_output2
           FROM prps
           WHERE objnr = st_output-objnr
           AND   pspnr = st_output-pspnr.
      SELECT SINGLE posnr from imzo into CORRESPONDING FIELDS OF st_output2
           WHERE objnr = st_output2-objnr.
    APPEND st_output2 to t_output2.
    ENDSELECT.
    ENDLOOP.
    LOOP AT t_output2 to st_output2.
    WRITE:   st_output2-posnr.
    ENDLOOP.

  • Latency is very high when SELECT statements are running for LONG

    We are a simple DOWN STREAM streams replication environment ( Archive log is shipped from source , CAPTURE & APPLY are running on destination DB).
    Whenever there is a long running SELECT statement on TARGET the latency become very high.
    SGA_MAX_SIZE = 8GB
    STREAMS_POOL_SIZE=2GB
    APPLY parallelism = 4
    How can resolve this issue?

    Is the log file shipped but not acknowledge? -- NO
    Is the log file not shipped? -- It is shipped
    Is the log file acknowledged by not applied? -- Yes...But Apply process was not stopped. it may be slow or waiting for something?
    It is 10g Environment. I will run AWR.. But what should i look for in AWR?

  • Button "Selected State" bug confirmed for Blu-ray on Mac

    I just confirmed today with Adobe tech support that, at the moment, menu button selected states are invisible on Blu-ray discs created with Encore on a Mac.
    Meaning, if you have 5 buttons linked to 5 different places, the buttons will all work, but you will have no idea what you're selected on- because they are invisible! There will be no "highlight" or "selected" state for the button. Once selected, you will see the "activated state" for the button for a split second, then it will take you to the proper target track. But again, no way of knowing what buttons are selected.
    They said if the video/menu assets are 4:3, the buttons work fine. Good to know, but a completely ridiculous suggestion.
    At the moment, there is no solution. They are "working on it."
    This is only a problem with Blu-ray projects on the Mac platform. Lucky me. To a hobbyist, this isn't a completely devastating problem- you can still watch the content of the disc. But this is enough of a problem for that I can't deliver it to clients like this. Wasted time and money troubleshooting this. This is a major problem.

    Adam. When you see the LAYERS window, click on and off on your highlights. There is a small white looking box. Deactivate and activate this. This will activate the selected and activated states. We had this problem a long time ago and found this to be the solution!
    DARREN

  • Syntax for creating foreign key across users in a database

    There are two user present A,B.They are granted all privileges.Now in USER A, there is a table PARENT whose primary key is PARENT_NO.In USER B I have created a table CHILD whose primary key is CHILD_NO.
    In the CHILD table of USER B, I want to create a foreign key relation to the PARENT table of USER A.For this I have created a column CHILD_PARENT_NO in the CHILD table.If anybody knows the syntax please post the syntax for creating the required foreign key relationship?

    Please post your code. Cut'n'paste from SQL*Plus like this...
    SQL> conn a/a
    Connected.
    SQL> desc t1
    Name                                      Null?    Type
    COL1                                               NUMBER
    COL2                                               VARCHAR2(10)
    SQL> grant references on t1 to b;
    Grant succeeded.
    SQL> conn b/b
    SQL> create synonym a_t for a.t1;
    Synonym created.
    SQL> alter table test add constraint fk foreign key (n) references a_t(col1);
    Table altered.
    SQL> Note that Oracle will translate the synonym anyway...
    SQL> select constraint_name, r_owner, r_constraint_name
      2  from  user_constraints
      3  where table_name = 'TEST'
      4  /
    CONSTRAINT_NAME R_OWNER R_CONSTRAINT_NAME
    FK              A       T1_PK
    SQL> By the way, this ...
    GRANT ALL PRIVILEGES TO B;... is a mindbendingly unsafe way of proceeding. In real life you would have given user B the power to utterly destroy your database. It's always easier to start with good habits than to break bad ones so please get used to granting only the minimum set of privileges necessary.
    Cheers, APC

  • LMS 3.2 syntax for specifying an interface for packet capture

    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Tableau Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-parent:"";
    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
    mso-para-margin:0cm;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:10.0pt;
    font-family:"Times New Roman";}
    Hi fellows,
    I have been trying to specify a particular interface on the packet capture windows and can not find the syntax on any documentation.
    It has to be something like @IPswitch /or: or ? and the interface
    Can someone have an example for the correct syntax?
    Thanks in advance
    Tewfiq

    You can't specify a device interface for packet capture.  The packet capture in LMS runs on the LMS server itself.  You can select a server interface and filter on a specific IP, but you cannot filter down to the device interface unless you filter on that device interface's IP address.  To filter on an IP, just type the IP address in the Address(es) text field.

  • A dynamic select statement as source for a shuttle item: use xmlagg

    Here is a suggestion:
    If you want to create a dynamic string of values for the source of a shuttle item, you can use the xmlagg trick.
    For example:
    select rtrim (xmlagg (xmlelement (n, e.ename|| ':') order by e.ename ).extract ('//text()'), ':') employee_name
    from emp e
    It will return s string of names: ADAMS:ALLEN:BLAKE:CLARK:FORD:JAMES:JONES:KING:MARTIN:MILLER:SCOTT:SMITH:TURNER:WARD
    Important is not to forget the "order by" clause inside the xmlagg.
    If you have installed the STRAGG function, you could use that one also.
    For example:
    select replace(stragg(e.ename),',',':') employee_name
    from (select ename
    from emp
    order by ename) e
    From Oracle 11gR2 there is another way: the LISTAGG function
    For example:
    select listagg(e.ename, ':') within group (order by e.ename) employee_name
    from emp e
    regards,
    Mathieu

    Hi Michael
    Check out this posting and KM;
    https://blogs.oracle.com/warehousebuilder/entry/odi_11g_simple_flexible_powerful
    Cheers
    David

  • Is possible to connect the 2 SELECTS statements into 1 for my stored procdr

    ELSE IF(@number = 2)
    BEGIN
    SELECT COUNT([outlet #])
    FROM OM
    WHERE [address] LIKE '%' + @address + '%';
    SELECT [outlet #], [name], address, [city/town], [postal code], telephone
    FROM OM
    WHERE address LIKE '%' + @address + '%'
    END
    Would it be possible to obtain the # of records and records in one shot
    Thank u for your time

    I suppose it depends on what you are really talking about, and what database and driver you are using.
    A statement can return more than one result set - see Statement.getMoreResults().

  • Select statement in a for loop

    Hi all,
    Can a select stmt be used in the body of the for loop/ nested for loop ?
    I tries using (even if its very simple for loop) it gives the following error
    PL/SQL: ORA-00933: SQL command not properly ended...
    code is
    DECLARE
    CURSOR C1 is select 'Monday'  from dual
    union all
    select 'Tuesday' from dual
    union all
    select 'Wednesday' from dual
    union all
    select 'Thursday' from dual
    union all
    select 'Friday' from dual
    union all
    select 'Saturday' from dual
    union all
    select 'Sunday' from dual;
            type rec_info is record
            name varchar2(20),
            FNAME varchar2(20),
            LNAME varchar2(20)
            type ty_info is table of rec_info;
            info ty_info;
            type rec_abc is record
            day varchar2(3000)
            type ty_abc is table of rec_abc;
            abc ty_abc;
            Cursor C2 is
            select t.name, u.first_name, u.last_name
            from territories t, users u, territories_users tu
            where t.ID = tu.TERRITORY_ID
            and tu.USER_ID = u.ID ;
    BEGIN
    OPEN C1;
    Loop
    FETCH C1 into abc;
    EXIT when C1%notfound;
    DBMS_OUTPUT.PUT_LINE(abc);
    END LOOP;
    CLOSE C1;
    OPEN C2;
    FETCH C2 BULK COLLECT into info;
    CLOSE C2;
           for i in info.first .. info.last
           LOOP
                       for j in abc.first .. abc.last
                       LOOP
                              select --info(i).name, info(i).FNAME, info(i),LNAME,'AM' "AM/PM",
                            to_char(c.name)||' '||ct.PRIMARY_ADDRESS_CITY||','||ct.PRIMARY_ADDRESS_STATE||','||ct.PRIMARY_ADDRESS_COUNTRY
                           from
                            territories t, territories_users tu,
                            users u, calls_users cu, calls c, 
                            calls_contacts cc, contacts ct    
                            where
                            tu.TERRITORY_ID = t.id
                            and t.name = info(i).name
                            and u.first_name = info(i).FNAME
                            and u.last_name = info(i).LNAME
                          and (c.date_start between trim(next_day(sysdate,abc(j).day)) and trim(next_day(sysdate,abc(j).day)))
                            and tu.USER_ID = u.id
                            and cu.USER_ID = u.id
                            and cu.CALL_ID = c.id
                            and to_char(c.time_start,'hh24') < '12'
                            and cc.CALL_ID = c.ID
                            and cc.CONTACT_ID = ct.id
                            and rownum < 2
                     END LOOP;
         END LOOP;
    END;

    "Can a select stmt be used in the body of the for loop/ nested for loop "
    Yes.... but with an INTO part.....
    select c1 , c2 , c3 into var1 , var2 , var3 from table1
    Sim

  • HT5449 Cannot Dictate "New Line" for a return key stroke.

    When using dictation I can't get "New Line" to work. It simply types this phrase! The "New Paragraph" command works, but adds all these additional spaces into my text. Has anybody got ideas on how to resolve? Is there another way to dictate a "return key"?

    I understand.
    Perhaps Apple Support in Australia would be willing to answer that one for you.  Their phone number is:
    (61) 1-300-321-456
    Or I wonder if there is some term used in Australia that means "new line" that might work (such as "return").  "Return" does not generate a new line here.

  • SELECT statement for VBKD - FAE in FPLT

    HI,
    For CS Report - Need to find the Conform Business (AMC is there But Invoice is Pending ).
    For This -->
    I need to take the table flow as - FPLT --> VBKD --> All (like VBAK, VBAP etc..)
    Problem is -->
    SELECT statement
    INTO IT_VBKD
    FOR ALL ENTRIES IN IT_FPLT
    WHERE fplnr = gwa_fplt-fplnr
    is taking too much time to execute.
    1. All Entries are Pending for Invoice ( FPLT- FKSAF = 'A' )
    2. No entry in VBFA table for this criteria.

    Thanks Vinod,
    Yes, I check it.
    But, In Client's system VBAK-rplnr is always Initial.
    Actually, I have data like -->
    AMC for duration - 01.07.2010 to 30.06.2011
    For which I am taking Four Billing Cycles -
    1. 01.07.2010 to 30.09.2010 - billed on 01.09.2010
    2. 01.10.2010 to 31.12.2010 - billed on 01.12.2010
    3. 01.01.2011 to 31.03.2011 - Unbilled - Projected billing date 01.03.2011       "
    4. 01.04.2011 to 30.06.2011 - Unbilled - Projected billing date 01.06.2011       "
    I have to consider Case 3 & 4 (unbilled). How can I calculate details for it?
    Report is working Fine - if I select - Selection options from FPLT - But while taking it from Sales Order - It's going to TIME OUT at SELECT statement itself.
    (Because table FPLT has more than 10Lac entries - and all are fetched )
    Edited by: Priya.ABAP on Dec 6, 2010 11:47 AM

Maybe you are looking for

  • Error When Starting the Portal Server - Plz Advise

    Hi.. I want to start the Portal Server. so, i followed the steps.. up the listener,dcm,emctl.. but, when i open the Em from browser "http://<host>:1810/ It stated that some component did'nt start.. So, i clicked Start All button.. it gaves me this er

  • Image size and profiles in Aperture;

    version 3.0.3. First problem is I can't see where I can fix the image size before getting to the print page! I prefer to do this and preview it before printing, as I used to in PS and then Lightroom. Other problem is that Aperture tells me to turn of

  • Syncing an Mac Mini with a Macbook Pro Over Wifi

    I'm setting up my new office and I've got a Mac Mini I've had for several years and a Macbook Pro that I use at home.  I travel quite a bit and it would be really nice to have my Mac Mini and my Macbook synced. I'd like to work all day on my Mac Mini

  • JTable as a data entry screen

    I am trying to use JTable for data entry. I assign few columns to contain Integer class type and others with Float. Now, the problem that arise is that Objects of Integer and Float are sub-classes class Number and JTable has by default a Cell Editor

  • Problem when finalizing project

    It seems like i am unable to finalize a IMovie project while my time-machine is turned on. I am getting an error message. Once I turn off Time machine the project will finalize and it works. Wonder if there is a permanent solution other than always m