Restriction in select command

in a alv report i have used select statement on 2 columns say crtno , range to select entries from a table1 db.
and i want to select again crtno (with few same entries) from another table2 in db.
what i want is to EXCLUDE earlier selected entries in crt no.
how can i EXCLUDE earlier selected entries from my i_tab.??
my code:
SELECT ZPACKH~CRTNO
   ZPACKH~RANGE
  INTO CORRESPONDING FIELDS OF TABLE I_LABOR
   FROM ZPACKH INNER JOIN ZCOMBO_MAT
  ON ZPACKHRANGE = ZCOMBO_MATMATNR.
IF I_LABOR[] IS NOT INITIAL.
     LOOP AT I_LABOR.
                 I_LABOR-LABOR = 'CM'.
                MODIFY I_LABOR INDEX SY-TABIX.
                CLEAR I_LABOR.
        ENDLOOP.
ENDIF.
SELECT ZPACKI~CRTNO
    ZPACKI~MATNR
    INTO CORRESPONDING FIELDS OF TABLE I_LABOR
    FROM ZPACKI INNER JOIN MARA
    ON ZPACKIMATNR EQ MARAMATNR.
some entries for crtno is same in zpackh and zpacki....... thats what i want select statement to not select already present entries in i_tab.

Use the [STABLE|http://help.sap.com/abapdocu_70/en/ABAPSORT_ITAB.htm#&ABAP_ADDITION_1@1@] option in the [SORT|http://help.sap.com/abapdocu_70/en/ABAPSORT_ITAB.htm] statement, so [DELETE|http://help.sap.com/abapdocu_70/en/ABAPDELETE_ITAB_SHORTREF.htm] [ADJACENT DUPLICATES|http://help.sap.com/abapdocu_70/en/ABAPDELETE_DUPLICATES.htm] will keep first record.
So
- SELECT FROM best table INTO itab
- SELECT FROM worst table APPENDING itab
- SORT itab BY key STABLE
- DELETE ADJACENT DUPLICATES FROM itab COMPARING key
Regards,
Raymond

Similar Messages

  • Restrict user SELECT query time on a particular VIEW

    Hi - I am trying to restrict user SELECT statemnet time on a particular view.There is a user called ABC and he is accessing many objects in database.All SELECT statments are fine execept when he query a particular VIEW.That view SELECT causing performance problem.So I am trying to restrict the SELECT query time on a VIEW.
    Can you please help me to achive this task through some SQL command like ALTER USER etc...
    Thanks for your help.

    user2538196 wrote:
    Hi - I am trying to restrict user SELECT statemnet time on a particular view.There is a user called ABC and he is accessing many objects in database.All SELECT statments are fine execept when he query a particular VIEW.That view SELECT causing performance problem.So I am trying to restrict the SELECT query time on a VIEW.
    Can you please help me to achive this task through some SQL command like ALTER USER etc...
    Thanks for your help.It sounds like you are really trying to solve a performance problem with the view. I agree with Justin that the solution to restrict access to the view dynamically sounds unwieldy.
    Consider tuning the view, or perhaps the query using the view. Post the view and see if anyone can help you tune it.

  • Select Command taking a lot of time to execute

    Dear Experts,
    My below SELECT command taking a lot of time to execute.
          SELECT wid
                       matl_desc
                       INTO TABLE open_wid FROM zwb_table
                       WHERE ( weight2 = 0 OR weight2 IS NULL ).
    Table : zwb_table contains around 7 Lacs records. That's why taking a lot of time . I have also Indexed the table zwb_table with field WID & WEIGHT2 . (zwb_table contains only WID as Primary Key Field)
    Structure of Internal Table : open_wid ->
                                             wid LIKE zwb_table-wid,
                                             matl_desc LIKE zwb_table-matl_desc,
    Please suggest me how to Improve the Performance of the above Select command.
    Thanks in Advance
    JACK

    Hi Jack,
    you are having morethan 7lack records in z table. it is not good practice fetching all the records into internal table and restricting with where clause in loop statement.
    I hope you already created secondary index combination of primary key.
    check you select query fetching records based on index you have created in ST05.
    Refer below link for your program is using index that you have created.
    Re: Indexing
    Regards,
    Peranandam
    Edited by: peranandam chinnathambi on Apr 7, 2009 8:38 AM

  • Beginner question: adding restrictions to JOIN command?

    So I'm trying to figure out how to add restrictions to JOIN commands. I've got these two tables AGENTS(aid, aname, city) and ORDERS(ordnum, cid, aid, qty, dollars). I'm trying to display all the agent names (aname) that are associated with the particular cid values 'c003' and 'c006' (the cid column contains values c001 through c006). Here is what I tried:
    SQL> SELECT aname FROM agents JOIN orders ON agents.aid = orders.aid WHERE cid='003' OR cid='006';
    Now I'm totally new to SQL so this may contain an obvious error, but I thought it made sense to simply put a WHERE clause at the end to place a restriction on the selection. Help would really be appreciated because I have been trying to figure out how to do this for hours.

    Welcome to the forum!
    user11920272 wrote:
    So I'm trying to figure out how to add restrictions to JOIN commands. I've got these two tables AGENTS(aid, aname, city) and ORDERS(ordnum, cid, aid, qty, dollars). I'm trying to display all the agent names (aname) that are associated with the particular cid values 'c003' and 'c006' (the cid column contains values c001 through c006). Here is what I tried:Are the values of cid 4 characters, as above ('c003' and 'c006') or 3 characters, as below ('003' and '006').
    SQL> SELECT aname FROM agents JOIN orders ON agents.aid = orders.aid WHERE cid='003' OR cid='006';You should always format your code. Use new lines and tabs to make the different clauses and the items in each clause stand out.
    For example, the query below is exactly what you posted, with a little white space added:
    SELECT  aname
    FROM    agents
    JOIN      orders          ON     agents.aid      = orders.aid
    WHERE     cid = '003'
    OR     cid = '006'
    ;When posting code, or any formatted text, on this site, type these 6 characters:
    (small letters only, inside curly brackets) before and after sections of formatted text, to preserve spacing.
    Now I'm totally new to SQL so this may contain an obvious error, but I thought it made sense to simply put a WHERE clause at the end to place a restriction on the selection. Help would really be appreciated because I have been trying to figure out how to do this for hours.I don't see any obvious errors.  You should get all the agents who have at least one order with either cid '003' or '006'.
    If there can be many orders for the same agent, then you'll get the agent's name repeated as many times as they have orders with the given cids.  If that's so, but you want each aname to appear only once, then change "SELECT" at the very beginning to "SELECT DISTINCT".
    Aside from the possible duplicates, the query above looks like a reasonable way to get from point A to point B.  Of course, if you're starting from point X and not A, and/or you want to go to point Y rather than point B, then it's not the route you want.
    So where are you, and where do you want to go?
    Please post a little sample data (maybe 2 to 5 rows from each table) and the results you want to get from that data.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • SELECT command denied

    Hi guys,
    We have an issue about toplink. We have two enviroments, a developer enviroment glassfish 2.1, windows xp and java 1.6. Our application have toplink essentials, JPA and some entities mapped. In developer enviroment it all works done but in test enviroment we cant execute any query! And we cant understand why, we talk with our DBA and he got all grants to user but we have allways same problem:
    [#|2009-12-30T12:31:03.562-0300|WARNING|sun-appserver2.1|oracle.toplink.essentials.session.file:/opt/glassfish/domains/domain1/applications/j2ee-apps/kmonitor-EAR/KMonitor-ejb_jar/-KMonitor|_ThreadID=225;_ThreadName=p: thread-pool-1; w: 196;_RequestID=fda25a98-2c3a-43d0-ae4e-4a1c1cd3167f;|
    Local Exception Stack:
    Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.1 (Build b31g-fcs (10/19/2009))): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: SELECT command denied to user 'km_dsv'@'cassini' for table 'fontestatus'
    Error Code: 1142
    Call: SELECT id_fontestatus, criacao, usuario_criacao, nome, alteracao, codigo, usuario_alteracao, descricao FROM kmonitor.fontestatus WHERE (id_fontestatus = ?)
         bind => [1]
    Query: ReadObjectQuery(com.knowtec.suiteic.kmonitor.informacao.entity.Fontestatus)
    Its the first query and its executed from JPA... we use mysql database.
    Here persistence.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
    <persistence-unit name="KMonitor" transaction-type="JTA">
    <jta-data-source>jdbc/kmonitor</jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties/>
    </persistence-unit>
    <persistence-unit name="KMonitor-standalone" transaction-type="RESOURCE_LOCAL">
    <non-jta-data-source>jdbc/kmonitor</non-jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
    </properties>
    </persistence-unit>
    </persistence>
    We use KMonitor in glassfish, stand-alone unit is not used and ignore it.
    Thanks!

    Hi I discovered problem. Top link doesnt have correct message for this problem!
    My entity had this annotation:
    @Entity
    @Table(name = "fontestatus", catalog = "databasename", schema = "")
    But catalog doesn´t exist in test enviroment, only development! solution is delete this:
    @Entity
    @Table(name = "fontestatus")

  • Sample code in Update Rule to restrict data selection?

    We used to restrict data selection in InfoPackage data selection, e.g., for company code range when loading data from a source system (e.g. EBP which is similar to R3), but somehow the company code range we set in InfoPackage data selection not working and we found actually it occurs on the source system side when running RSA3 on EBP side and input the company code range in RSA3 selection section, but still it extracts data beyond the company code range.  We don't understand why EBP data selection doesn't work, then we consider in update rule on BW to set the company code range.  We know in update rule, we can select Start Routine, formula, or routine to set the company code range.  But we would be appreciated if experts here can recommend which one is the most efficient to load data fast for data load performance reason and would be appreicated if you can let us know the sample code!
    Thanks in advance!

    hi Hari,
    I copy the whole code of the start routine below:
    PROGRAM UPDATE_ROUTINE.
    $$ begin of global - insert your declaration only below this line  -
    TABLES: ...
    Includes to update generic objects
    INCLUDE rsbctgn_top .
    INCLUDE rsbctgn_update_rules .
    INCLUDE rsbctbbp_generic_objects.
      The following section is prepared for you if you compound
      the business partner 0BPARTNER with the
      Source System 0BBP_SYS_BP or if you compound the organizational
      Unit 0ORGUNIT with the source System 0BBP_SYS_BP
    TYPE-POOLS: RRSV.
    Data: L_HLP_CHAVL_CMP       TYPE RSCHAVL.
    DATA:
           L_S_DEP       TYPE RRSV_S_DEP,
           L_T_DEP       TYPE RRSV_T_DEP.
      End of compound
    DATA: l_s_errorlog        TYPE rssm_s_errorlog_int,
          l_hlp_chavl         TYPE rschavl.
    $$ end of global - insert your declaration only before this line   -
    The follow definition is new in the BW3.x
    TYPES:
      BEGIN OF DATA_PACKAGE_STRUCTURE.
         INCLUDE STRUCTURE /BIC/CS0BBP_CONF_TD_1.
    TYPES:
         RECNO   LIKE sy-tabix,
      END OF DATA_PACKAGE_STRUCTURE.
    DATA:
      DATA_PACKAGE TYPE STANDARD TABLE OF DATA_PACKAGE_STRUCTURE
           WITH HEADER LINE
           WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
    FORM startup
      TABLES   MONITOR STRUCTURE RSMONITOR "user defined monitoring
               MONITOR_RECNO STRUCTURE RSMONITORS " monitoring with record n
               DATA_PACKAGE STRUCTURE DATA_PACKAGE
      USING    RECORD_ALL LIKE SY-TABIX
               SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
      CHANGING ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update
    $$ begin of routine - insert your code only below this line        -
    fill the internal tables "MONITOR" and/or "MONITOR_RECNO",
    to make monitor entries
    delete data_package where 0comp_code < 'X300' OR 0comp_code > 'X6ZZ'.
    if abort is not equal zero, the update process will be canceled
      ABORT = 0.
    $$ end of routine - insert your code only before this line         -
    ENDFORM.

  • Using a VARCHAR2 in a SELECT command

    I'm trying to query for a given path in a hierarchy of products. However, I want to be able to have it return multiple values. So, I created a string in my function below that returns identifiers like "(34, 43, 54)" to be used in a SELECT IN. The function works fine, but the select command fails. How can I get the SELECT to work?
    CREATE TABLE PRODUCT (
      PRODID NUMBER,
      PARENTID NUMBER,
      CATID NUMBER,
      ALIAS VARCHAR2(128)
    CREATE OR REPLACE FUNCTION FIND_PRODS_BY_PATH
    (CAT_ID IN NUMBER, IN_PATH IN VARCHAR2) RETURN VARCHAR2 IS
      PROD_IDS VARCHAR2(1024);
    BEGIN
      PROD_IDS := '(';
      FOR PROD IN (SELECT PRODID, SYS_CONNECT_BY_PATH(ALIAS, '/') AS PATH FROM PRODUCT
        WHERE CATID=CAT_ID CONNECT BY PRIOR PRODID=PARENTID)
      LOOP
        IF REGEXP_LIKE(PROD.PATH, IN_PATH) THEN
          IF LENGTH(PROD_IDS) > 1 THEN
            PROD_IDS := PROD_IDS || ', ';
          END IF;
          PROD_IDS := PROD_IDS || PROD.PRODID;
        END IF;
      END LOOP;
      PROD_IDS := PROD_IDS || ')';
      RETURN PROD_IDS;
    END FIND_PRODS_BY_PATH;
    *** Doesn't like the varchar2 returned from the function ***
    SELECT * FROM PRODUCT WHERE PRODID IN FIND_PROD_BY_PATH(5, '/my/product/path/*');
    Error report:
    SQL Error: ORA-01722: invalid number
    *** Function works ***
    SELECT FIND_PROD_BY_PATH(5, '/my/product/path/*') FROM DUAL;
    FIND_PRODS_BY_PATH(5, '/my/product/path/*')                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
    (301152, 301202, 301252, 301302, 301403)

    Your function is effectively returning a single string, which is not automatically devived into individual tokens for using in the IN clause.
    How to circumvent this is best described here:
    http://www.oracle.com/technology/oramag/oracle/07-mar/o27asktom.html
    (search for "Varying IN Lists")

  • 2 way restriction of select lists

    Hello all,
    I have a requirement in my application in which I need to restrict the select lists in both ways unlike the cascading select lists.
    I have Select lists for Department and Application. If a user selects Department first, I need to restrict the options for Applications. Or if the user select Application first, I need to restrict the options for Department.
    Is there any way to do this? I have worked on cascading select lists before using Denes Kubicek's example and they worked pretty well. But the only problem implementing the same logic here is initially I need both the lists to be populated unlike cascading where the user is forced to select from the first select list and then following select lists are populated.
    Can someone please help me with this.
    Your help is highly appreciated.
    Thanks,
    Shravanthi

    Hi Shravanthi,
    As long as you have some default null value in both lists set to return -1, it should work just by setting the restriction in the SQL of the lists, like:
    List 1 -
    select name from department where (application_id = to_number(:P1_APPLICATION) or to_number(:P1_APPLICATION) = -1)List 2 -
    select name from application where (department_id = to_number(:P1_DEPARTMENT) or to_number(:P1_DEPARTMENT) = -1)Hope this helps,
    Aaron

  • Problem with MySQL - WLS61:General error: select command denied to user: 'foo@lion.e-pmsi.fr' for table 'finess'

    Hi
    I've been trying to adapt and deploy an enterprise appliaction developped and deployed
    before under JBoss.
    My database is MySQL and I use Together Control Center for development and hot deployment.
    After having modified a lot of things (the seamless protability seems always sor
    far :), now I get some strange error when deploying from withing Together Control
    Center 6.0:
    WLS61:General error: select command denied to user: '[email protected]' for table
    'finess'
    Off course the user foo has all possible and imaginable rights.
    Does anybody have an idea on how to get around it ?
    Thanks
    Alireza

    Found the answer... email that went to junk mail. Hope this helps others!
    Hello Subscription User,
     Thanks for choosing ClearDB for your database needs. We appreciate your business and 
     your interest in our services. Our commitment to all of our customers is that we 
     provide a high quality of service on all of our database systems. Part of that 
     commitment includes the enforcement of database size quotas in order to ensure 
     the highest quality of service for our customers.
     As such, we're sending you this automated message regarding one of your databases:
     Database: wp____
     Tier/Plan: Mercury
     Tier size quota: 20 MB
     This database has either reached or has exceeded its maximum allowed size for the 
     'Mercury' plan/tier that it currently belongs to. As such, our systems were forced to 
     place a read-only lock on it. We kindly encourage you to upgrade your database 
     to a larger tier/plan so that we can restore write privileges and enable complete 
     access to it from your account.
     If you feel that you have received this notification in error, please feel free 
     to contact us by replying to this email along with information that you feel may 
     assist us in assessing the situation with your database.
     Thanks again for choosing ClearDB,
     The ClearDB Team

  • Cannot change SELECT command Datalist

    Hi , 
    I have a datalist with a selectedcommand , but i want to change it at runtime ( i have a dropdownlist and want to search based upon the values of dropdownlist) , I used this in button click event:
    if (DropDownList1.Text=="blabla")
                this.SqlDataSource1.SelectCommand = "SELECT prodID,[Prodname], [Price], [ProdCode], [Weights], [Size], [Photo] FROM [Products] where Cat='ct1' and Price<10000 ";
                this.SqlDataSource1.DataBind();
                DataList1.DataBind();
    but  nothing happens. I also tried http://social.msdn.microsoft.com/Forums/sqlserver/en-US/b1d4a3a5-7ba3-4383-a52a-fd472f1aad11/change-sqldatasource-select-command-at-runtime?forum=Offtopic 
    but it doesn't work for me . any ideas ?

    Hi,
    Try the below code.
    if (DropDownList1.Text == "blabla")
    SqlDataSource SqlDataSource1 = new SqlDataSource();
    SqlDataSource1.SelectCommand = "SELECT prodID, [Prodname], [Price], [ProdCode], [Weights], [Size], [Photo] FROM [Products] where Cat='@cat' and Price < @price";
    SqlDataSource1.SelectParameters.Clear();
    SqlDataSource1.SelectParameters.Add("cat", TypeCode.Int32, "1");
    SqlDataSource1.SelectParameters.Add("price", TypeCode.Decimal, "1");
    //your connection string from web.config
    SqlDataSource1.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectString"].ConnectionString;
    DataList1.DataSource = SqlDataSource1;
    DataList1.DataBind();
    SRIRAM

  • SQL: combined SELECT-command possible???

    Hello Experts!
    in the enclosed SQL-command I'm actually selecting from table EKPO only the open POs with no reference in order-history (EKBE). Now I want to enlarge/combine this command in that way that additionally records from order history (EKBE) with a special movement type in EKBE are selected on top.
    Is it possible or do need a second select-command in the Z-application???
    THANKS for a response.
    Regards,
    Bernd
    select ebeln ebelp menge meins txz01 bukrs matkl
             werks matnr mtart labnr elikz pstyp from ekpo as b
        into (itab-bestnr, itab-pos, itab-best_mng,itab-meins, itab-text,
             itab-bukrs, itab-matkl, itab-werks, itab-matnr, itab-mtart,
             itab-labnr, itab-elikz, itab-pstyp)
        where ( mtart = 'ETMW' or mtart = 'ETVB' ) and
              menge > 0 and
              loekz <> 'L' and
              loekz <> 'S' and
              elikz <> 'X' and  " Endliefer-KZ
              ebelp not in ( select ebelp from ekbe where
                                    ebeln = b~ebeln ).
    Edited by: Bernd Thielemann on Jul 21, 2008 4:37 PM

    The result should be all open orders!
    1.) no EKBE
    2.) EKBE but quantity of goods receipt (WE) is less than quantity of the PO
    3.) intercompany-POs (stock transport order) have other movement types (like LFS and WA) which do not effect the status of the open PO until good-receipt movement is posted in the receiving plant .
    First/Second condition is realized. Third condition is the gap until now.
    Regards,
    Bernd

  • Problem on select command for table AFKO-GSTRS,AFKO-GSUZS

    Hi all Abaper,
    I faced a problem on using select command to select out the records from table AFKO (Production order header)
    If i want to select out records that
    AFKO-GSTRS >= 14.4.2006 (schedule start date)
    AFKO-GSUZS >= 00:00:00 (schedule start time)
    AFKO-GSTRS <= 15.4.2006 (schedule start date)
    AFKO-GSUZS <= 00:00:00 (schedule start time)
    The select statement:
    SELECT AUFNR RSNUM DISPO GSTRS GSUZS
            INTO TABLE GT_AFKO FROM AFKO
                    WHERE
           ( GSTRS >= GV_ST_DATE AND GSUZS >= GV_ST_TIME )
       AND ( GSTRS <= P_DATE AND GSUZS <= P_TIME ).
    PS.  if GV_ST_DATE = 14.4.06,  GV_ST_TIME = '00:00:00'
            P_DATE AND = 15.4.06,      P_TIME = '00:00:00'
    This statement just select out records in
    between 14-15.4.06 and at time '00:00:00'.
    some Production orders at 14.04.06 ,'09:00:00' will be filter out.
    I know the problem on that system just consider the date and time separately.
    Does anyone know how to link the date and time up? or does any data type allow for combination of date and time data?
    Thx for your reply in advance~

    Thx Amit and Vijay.
    The data type for GV_ST_DATE, P_DATE are <b>SY-datum</b>
    and GV_ST_TIME, P_TIME  are <b>SY-UZEIT</b>
    Actually, P_DATE & P_TIME are user input parameters.
    The records I wanna get are the period back 24 hrs from P_DATE & P_TIME.
    For example, if user input P_DATE = 15.04.2006,
                               P_TIME = '10:00:00'.
    Then records selected out should be:
    from 14.04.2006 , '10:00:00' TO 15.04.2006, '10:00:00'
    if production order schedule start = <b>14.04.2006 , 09:00:00</b>
    it will be <b>included</b>.
    if production order schedule start = <b>15.04.2006 , 01:00:00</b>
    it will be <b>excluded</b>.
    However, the following statement cannot get the desired records.
    Select....
    where GSTRS >= GV_ST_DATE AND GSUZS >= GV_ST_TIME
    AND   GSTRS <= P_DATE AND GSUZS <= P_TIME.
    Since GV_ST_TIME & P_TIME are both = '00:00:00',
    for Production order( sch start date = 14.04.2006 , sch start time = 09:00:00 ), '09:00:00' is greater than '00:00:00' but it is not less than '00:00:00'.
    Thus, this Pro. Order will be filtered!!
    However can improve my SQL statement to get the desired data?

  • Long select command

    hey, I have a real long select command and it goes down to the next row of my sql*plus. when i try to perform it it says the from statement is in the wrong spot but its just getting confused. how do i fix this?

    Just manually edit the query and add adequate line feeds. That would make the query readable too.

  • SELECT Command on Associative Array

    Guys,
    I have a question on associative arrays in ORACLE.
    I m working on one assignment where I am not allowed to create any object into the database e.g. Create temporary tables, use of cursors etc.
    For data manipulation i used associative array, but at the end i want to show that result in pl/SQL developer.
    I know that I can't use select command on associative arrays.
    Any alternative/solution for it?
    Also is there any way that i can write the contents of associative array to a .csv file?

    user13478417 wrote:
    I m working on one assignment where I am not allowed to create any object into the database e.g. Create temporary tables, use of cursors etc.Then cease to use Oracle - immediately. As you are violating your assignment constraints.
    ALL SQL and anonymous PL/SQL code blocks you send to Oracle are parsed as cursors. And as you are not allowed to use cursors, it will be impossible to use Oracle as cursors is exactly what Oracle creates... and creates a lot of. For every single SQL statement. And every single anonymous PL./SQL block.
    For data manipulation i used associative array, Why? Arrays is a poor choice in Oracle as a data structure most times as it is inferior in almost every single way to using a SQL table structure instead.
    Pumping data into an array? That already severely limits scalability as the array requires expensive dedicated server (PGA) memory. It does not use the more scalable shared server (SGA) memory.
    Manipulating data in an array? That requires a "+full structure scan+" each time as it does not have the indexing and partitioning features of a SQL table.
    Running a SQL select on an array? That is using a cursor. That also means copying the entire array structure, as bind variable, from the PL/SQL engine to the SQL engine. An excellent way to waste memory resources and slow down performance... but hey you can still shout "+Look Ma, no --brains-- hands, I'm not using any SQL tables as dictated by my assignment!+".... +<sigh>+
    Any alternative/solution for it?You mean besides using Oracle correctly ?
    You could reload the shotgun and shoot yourself in the other foot too. That should distract you for from the pain in the first foot.

  • Select command on sqlplus

    Hello,
    We have our first Oracle database here, and I'm finding some problems to deal with sqlplus.
    When I start a select command to list the rows from a table which has 567 rows, I have a very big answer and I'm not able to see the first columns...
    I'd like to know how I can obtain the answer page by page...
    Is this possible ?
    Eduardo

    try:
    set pagesize 10This will give you a header every ten lines.
    Of course, you may ALSO have to do
    set linesize 120or something based on your screen size.
    and also, you may have to set each columns (that you are selecting like this
    col some_column_name format a10This will format it to 20 characters eventhough the column is defined as let's say varchar2(100).

Maybe you are looking for

  • Batch Selection at goods Issue

    Hi All, I am using batch management . When I want to issue using 201 mvt., in batch field, the selection for batches lists all the batch numbers that were entered at GR, inspite of whether stock is available for the batch or not. If i want to display

  • Getting error while configuring WebSphere application server in JDeveloper

    Hi all, I have installed Oracle Jdeveloper 11g(11.1.1.5.1) and WebSphere application server 7 I am trying to create New Application server as "WebSphere" and entered following information. Host Name : wkstn90 SOAP Connector port: 8880 Server Name: se

  • Boolean Condition on a Tab Not Working

    Hello! I have a tab that should only appear if a record is in the database. I'm using a 'PL/SQL Function Body Returning a Boolean' condition with the following: DECLARE t1 varchar2(20); BEGIN select GROUP into t1 from pl_department where userid = :AP

  • How     do we create shift group

    hai friends, how to create shift group plz suitable answer will be rewareded aruna

  • Calling AIF for Value Mapping from standard ES

    Hello All, Is there any option of using SAP AIF for standard ES (for adding value mapping). We have requirement where value mapping needs to be done for standard ES. I was thinking of making explicit call to AIF using following method : * Call method