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")

Similar Messages

  • Using a varchar field to select statement

    Hi all
    I have a single row and single column table
    T(command varchar2(4000))
    and the row is
    sno,name
    And I have another table T1(sno number,name varchar)
    Now can any body tell how can i use command column in table T to query T1 to get sno,name from T1
    I am looking for a select statement like this
    select (select command from T) from T1;
    but it is printing out the data in T i mean sno, name
    This is a copy of thread Selecting output of a select statement
    but explained more clearly
    Thanks,
    ganesh.

    I don't know why your tables are designed like this but what I think you want to do is join T1 with the data in T.
    select sno, name from T1
    where sno in (select substr(command,0,instr(command,',')-1) from T)
    and name in (select substr(command,instr(command,',')+1) from T);
    substr returns a string up to a position
    instr returns the position of a string
    and the other post you refer to as about as confusing as your one.

  • Using a Variable in SSIS - Error - "Command text was not set for the command object.".

    Hi All,
    I am using a OLE DB Source in my dataflow component and want to select SQL Query from the master table  I have created variables v_Archivequery
    String packageLevel (to store the query).
    <Variable Name="V_Archivequery" DataType="String">
         SELECT a.*, b.BBxKey as Archive_BBxKey, b.RowChecksum as Archive_RowChecksum
         FROM dbo.ImportBBxFbcci a LEFT OUTER JOIN Archive.dbo.ArchiveBBxFbcci b
         ON (SUBSTRING(a.Col001,1,4) + SUBSTRING(a.Col002,1,10)) = b.BBxKey
         Where (b.LatestVersion = 1 OR b.LatestVersion IS NULL)
        </Variable>
    I am assigning this query to the v_Archivequery variable, "SELECT a.*, b.BBxKey as Archive_BBxKey, b.RowChecksum as Archive_RowChecksum
    FROM dbo.ImportBBxFbcci a LEFT OUTER JOIN Archive.dbo.ArchiveBBxFbcci b
     ON (SUBSTRING(a.Col001,1,4) + SUBSTRING(a.Col002,1,10)) = b.BBxKey
    Where (b.LatestVersion = 1 OR b.LatestVersion IS NULL)"
    Now in the OLE Db source, I have selected as Sql Command from Variable, and I am getting the variable, v_Archivequery .
    But when I am generating the package and when running I am getting bewlo errror
     Error at Data Flow Task [OLE DB Source [1]]: An OLE DB error has occurred. Error code: 0x80040E0C.
    An OLE DB record is available.  Source: "Microsoft SQL Native Client"  Hresult: 0x80040E0C  Description: "Command text was not set for the command object.".
    Can Someone guide me whr am going wrong?
    Please let me know where am going wrong?
    Thanks in advance.
    Thankx & regards, Vipin jha MCP

    What happens if you hit Preview button in OLE DB Source Editor? Also you can use the same query by selecting SQL Command option and test.
    Could you try set the Delay Validation = True at Package and re-run ?
    If set the query in variable expression (not in value), then Set Evaluate As Expression = True.
    -Vaibhav Chaudhari

  • On the use of VARCHAR2 vs. CHAR

    I'm posting an e-mail thread that has been moving around in my organization, whith guidance from an Oracle representative.
    The basic issue concerns the use of CHAR vs. VARCHAR2 when defining a table in Oracle.
    I would like to get some comments from the community at large.
    1. Business semantics should be represented in every aspect of a database, application, and design as far as I am concerned. Noteably, if the business rule at a corporate entity is clearly stated that when using Oracle the use of CHAR should be limited to those attribute implementations which have the following characteristics; a) The attribute may not be null, b) The attribute must have a character in each of the declared positions.
    2. When the Visual Basic application began writing data to the CHAR columns in your application someone should have had a discussion with the developer to find out why this was happening. If the business semantics changed then the logical implemention of the business semantics should have changed as well. That the two were disconnected is not a problem with the CHAR type, it is a problem with the designer or the developer. The bottom line on this instance is that the column should have been defined as a VARCHAR2 data type since the business semantics no longer complied with the criteria set forth in the previous paragraph.
    3. I think Oracle trys to load as much of the data from a table or index into shared memory, in this case the database block buffers, as it can in order to facilitate query operations. If Oracle has enough memory and can load a table or index into memory, it will do so. At the same time the database engine will move previously cached data out of memory to accommodate the new requirement.
    -----Original Message-----
    Thank you for the detail information on CHAR and VARCHAR2. It got me thinking with a DBA hat. I worked as a DBA before and I did use the CHAR type and I will share my experience/thought on CHAR.
    I don't like to use the char type like Tom has advised because Oracle does not check to see if the value being inserted fills up the column or not which can lead to a problem. And there is no performance gain or save space in Oracle.
    I worked as a DBA before, I used char type on the "must fill/always filled" column (pre DMDC). The application was written in VB with Oracle back end. At some point, VB started inserting values that are short of the column width and created a minor problem (it was supposed to be filled column). The problem was quickly identified and fixed, but it caused an issue.
    I realize that I don’t want to define it as a "must fill/always filled" column if you can't enforce it by simply defining the char data type on a table and prevent possible issue in the future.
    For a manager, in order to use the char properly, you have to hire client developers with Oracle experience or provide a basic Oracle training in order to avoid the problem I mentioned above in order to use the char type correctly.
    I think you, Tom and I are saying the same thing really. Only difference is that Tom and I can not think of a good reason why anyone would like to indicate the business semantics using column type on the database, when it can lead to more work/issues.
    In regards to wasted 25 million byes, why would Oracle load the table with 25 million rows? Shouldn't it use an index? Don't you have a serious problem if Oracle is loading table with the 25 million rows?
    Just my two cents... : )
    -----Original Message-----
    May I beg to differ?
    CHAR plays a vital role in the intuitive interpretation of a database schema. If designed correctly, the use of CHAR tells anyone who is in the know that this is a must fill column. Thus if a column is defined as CHAR(3) everyone should know that the column will always contain three characters. Defining the column as VARCHAR2(3) does not tell you anything about the data other than that the column may contain 0-3 characters.
    Also, If a column is defined as CHAR the column should always be populated. One of the nice features of VARCHAR2 is that if the column is defined at the end of a table, there is no storage overhead until that column is actually populated. Thus if you have a table that has an identifier that is nine characters in length and will always be populated with nine characters, an attribute which describes the type of identifier which is contained in the first column and which must always be populated and is a must fill attribute, and another column which is descriptive and may vary in length or not be populated at time of insert; the following definition does not express the business semantics of the entity:
    COL_CD VARCHAR2(9)
    COL_TYP_TXT VARCHAR2(26)
    COL_TYP_CD VARCHAR2(2)
    The above definition also does not take advantage of inherent storage features of Oracle; notably there is a wasted place holder between COL_CD and COL_TYP_TXT and between COL_TYP_TXT and COL_TYP_CD. The next definition does take advantage of the storage features but does not represent the business semantics of the entity:
    COL_CD VARCHAR2(9)
    COL_TYP_CD VARCHAR2(2)
    COL_TYP_TXT VARCHAR2(26)
    The above definition does not waste space storing a place holder between COL_TYP_CD and COL_TYP_TXT if the COL_TYP_TXT may be null. The column separator will only be used when the column contains data. The below definition satisfies both the storage and business semantics issues:
    COL_CD CHAR(9)
    COL_TYP_CD CHAR(2)
    COL_TYP_TXT VARCHAR2(26)
    This may seem pedantic in nature until you consider the situation where there are 25 million rows in the table represented by the above entity. If each row has a NULL COL_TYP_TXT value then the first example wasted 25 million bytes of storage and 25 million bytes of memory if the full table is loaded into memory. This is an issue which cannot be ignored in high volume databases.
    You may wish to know why it is important to define a must fill/always fill column as a CHAR to express the business semantics of an attribute. I can't give a definitive answer to that other than to say that it is just good database manners.
    So please, continue to use CHAR when the shoe fits. Don't throw something away that has use just because it is not popular or in the mode.
    Also, if I am mistaken in any of the above, please feel free to educate me.
    Thanks.
    -----Original Message-----
    Subject: RE: Oracle on the use of VARCHAR2 vs. CHAR
    Ignore if you already got this. This is just FYI.
    -----Original Message-----
    Below is a detailed answer to your VARCHAR2 or CHAR questions from our Database expert Tom Kyte. The short answer is VARCHAR2 is what you want to use. If you have any questions or want to discuss this in more detail let me know.
    A CHAR datatype and VARCHAR2 datatype are stored identically (eg: the word 'WORD' stored in a CHAR(4) and a varchar2(4) consume exactly the same amount of space on disk, both have leading byte counts).
    The difference between a CHAR and a VARCHAR is that a CHAR(n) will ALWAYS be N bytes long, it will be blank padded upon insert to ensure this. A varchar2(n) on the other hand will be 1 to N bytes long, it will NOT be blank padded.
    Using a CHAR on a varying width field can be a pain due to the search semantics of CHAR.
    Consider the following examples:
    ops$tkyte@8i> create table t ( x char(10) ); Table created.
    ops$tkyte@8i> insert into t values ( 'Hello' );
    1 row created.
    ops$tkyte@8i> select * from t where x = 'Hello';
    X
    Hello
    ops$tkyte@8i> variable y varchar2(25)
    ops$tkyte@8i> exec :y := 'Hello'
    PL/SQL procedure successfully completed.
    ops$tkyte@8i> select * from t where x = :y; no rows selected
    ops$tkyte@8i> select * from t where x = rpad(:y,10);
    X
    Hello
    Notice how when doing the search with a varchar2 variable (almost every tool in the world uses this type), we have to rpad() it to get a hit.
    If the field is in fact ALWAYS 10 bytes long, using a CHAR will not hurt -- HOWEVER, it will not help either.
    The only time I personally use a CHAR type is for CHAR(1). And that is only because its faster to type char(1) then varchar2(1) -- it offers no advantages.
    If you just use varchar2 everywhere, no problem
    My advice is, has been, will be very loudly stated as:
    IGNORE THE EXISTENCE OF CHAR.
    period. If you never use char, you never compare char to varchar2, problem solved.
    And if you use char and compare a char(n) to a char(m) they will never compare either.
    Just say NO TO CHAR.
    **************************************************

    Hi,
    >>A CHAR datatype and VARCHAR2 datatype are stored identically (eg: the word 'WORD' stored in a CHAR(4) and a varchar2(4) consume exactly the same amount of space on disk, both have leading byte counts).
    Ok, but on the other hands:
    SGMS@ORACLE10> create table x (name char(10), name2 varchar2(10));
    Table created.
    SGMS@ORACLE10> insert into  x values ('hello','hello');
    1 row created.
    SGMS@ORACLE10> commit;
    Commit complete.
    SGMS@ORACLE10> select vsize(name),vsize(name2) from x;
    VSIZE(NAME) VSIZE(NAME2)
             10            5
    SGMS@ORACLE10> select dump(name),dump(name2) from x;
    DUMP(NAME)                                         DUMP(NAME2)
    Typ=96 Len=10: 104,101,108,108,111,32,32,32,32,32  Typ=1 Len=5: 104,101,108,108,111Cheers

  • How to retrieve data using logical database and custom select options

    Hi all,
    I have a selection screen which is displayed by logical database PSJ and I have two select options of my own. I need to retrieve data based on both selection screen of logical database and my own select options. How can I do it?
    Thanks in advance.

    Hai Gupta
    Check the following Document & Links
    1. A logical database is in fact
    a program only.
    2. This LDB provides two main things :
    a) a pre-defined selection screen
    which handles all user inputs and validations
    b) pre defined set of data
    based upon the user selection.
    3. So we dont have to worry about from
    which tables to fetch data.
    4. Moreover, this LDB Program,
    handles all user-authorisations
    and is efficient in all respects.
    5. tcode is SLDB
    good info about Logical Database. you can check the link.
    http://www.geekinterview.com/question_details/1506
    http://help.sap.com/saphelp_46c/helpdata/EN/35/2cd77bd7705394e10000009b387c12/frameset.htm
    Re: How to Create and Use ldb in reports?
    Re: Logical databases
    http://help.sap.com/saphelp_46c/helpdata/en/9f/db9bed35c111d1829f0000e829fbfe/frameset.htm
    Functions for displaying and changing logical databases:
    Call Transaction SE36 or
    Choose ABAP Workbench -> Development -> Programming environ. -> Logical databases
    Interaction between database program and report:
    During program processing, subroutines are performed in the database program and events are executed in the report.
    To read data from a database tables we use logical database.
    A logical database provides read-only access to a group of related tables to an ABAP/4 program.
    advantages:-
    The programmer need not worry about the primary key for each table.Because Logical database knows how the different tables relate to each other,and can issue the SELECT command with proper where clause to retrieve the data.
    i)An easy-to-use standard user interface.
    ii)check functions which check that user input is complete,correct,and plausible.
    iii)meaningful data selection.
    iv)central authorization checks for database accesses.
    v)good read access performance while retaining the hierarchical data view determined by the application logic.
    disadvantages:-
    i)If you donot specify a logical database in the program attributes,the GET events never occur.
    ii)There is no ENDGET command,so the code block associated with an event ends with the next event
    statement (such as another GET or an END-OF-SELECTION).
    1. transaction code SLDB.
    2.enter name z<ldb-name>
    3.create
    4.short text
    5.create
    6. name of root node (here Ekko)
    7. enter short text (f6)
    8.node type -> data base table.
    9.create
    10 change logical DB
    riht click on ekko and insert node
    here node name ekpo
    11.create
    12. click on selections
    13. press no Should the changed structure of Z<ldb name> be saved first.
    14.select tables which you want to join.
    15.transfer
    16 now you have to o to coding part.
    17. save
    activate.
    19.click to src code
    double click on first include and activate
    Regards
    Sreeni

  • 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")

  • Limitations in using a function within a select statement

    I have a function which retrieves various data elements from the
    database and formats it accordingly. The data (varchar2)
    returned could be in excess of 2,000 characters length.
    I need to use the returned data as part of a view. I am able to
    use the function in a "select" statement, but when I use it with
    returned data in excess of 2,000 chars, I get the following
    error:
    ORA-06502: PL/SQL: numeric or value error
    This error is occurring whenever the returned data is in excess
    of 2,000 characters.
    Is there an alternative method to what I am proposing, I have
    tried alternative data types but if I am able to use it in a
    "select" statement, I get the above error when the returned
    length exceeds 2,000 chars.
    Thanks
    Peter

    are u using oracle 7. varchar2 limit in 8 is 4000.

  • When i try and open a tab that is the same as the page im currently on i closes it self. not when i type the full address, but when i use the arrow keys to select the url and press enter

    when I try and open a tab that is the same as the page I'm currently on it closes it self. Not when I type the full address, but when I use the arrow keys to select the url and press enter. I just don't like typing in the same address 5 times, when the older Firefox worked.

    Hi
    AutoPunch enabled? Command click in the bottom half of the Bar Ruler to turn it off
    CCT

  • Use of cursors insted of select statements

    could any one please explain what is the advantage of using cursors instead of simple select statements
    thanks
    siby

    A benefit to using an explicit cursor rather than a select statement, is for the NO_DATA_FOUND exception. Its kind of like a free IF statment. IF no data is found, then stop.
    if you write a select statement, and no data is returned, you SHOULD code for the NO_DATA_FOUND exception. Often people say, "i'll ALWAYS get a row returned". but you should always cover your code "just in case". so you must code an exception...
    declare
    v_var varchar2(1);
    procedure do_something(p_parm varchar2) is
    begin
    null;
    end do_something;
    procedure log_error is
    begin
    null;
    end log_error;
    begin <<main>>
    do_something('x');
    begin <<selectblock>>
    select dummy
    into v_var
    from dual
    where dummy = 'a';
    do_something(v_var);
    exception
    when no_data_found then
    log_error;
    end selectblock;
    do_something (v_var||'abc');
    end main;
    if you use an explicit cursor instead, you don't need to code for the NO_DATA_FOUND. If an explicit cursor opens and finds no rows, there are simply no rows. of course, you don't need a loop if you expect only 1 row returned under normal circumstances.
    BTW, don' forget that SQL%ROWCOUNT and your_cursor%ROWCOUNT are not initialized. There is a null, until a row is successfully fetched. therefore if no rows are returned at all, %ROWCOUNT is NULL.
    declare
    v_var varchar2(1);
    cursor my_cur is
    select dummy
    from dual
    where dummy = 'a';
    procedure do_something(p_parm varchar2) is
    begin
    null;
    end do_something;
    procedure log_error is
    begin
    null;
    end log_error;
    begin << main>>
    for cur_rec in my_cur loop
    dbms_output.put_line('inside');
    begin <<loop_block>>
    if nvl(my_cur%rowcount,0) > 1 then
    do_something(cur_rec.dummy);
    else
    log_error;
    end if;
    end loop_block;
    end loop;
    end main;
    /

  • If I do NOT use any event, except AT SELECTION SCREEN, Do I get any issues?

    Hi Experts,
    Pls. let me know that, If I do NOT use any event, except AT SELECTION SCREEN, Do I/prog. get any issues? (am also using AT SELECTION SCREEN OUTPUT for list box preperation).
    For some reason(execution of the report prog. with ENTER button), am using ONLY these 2 events.
    For full detials, pls. see my other thread with title,
    Is it possible to execute a REPORT prog. with pressing of ENTER button?
    thanq

    Hi
    srinivas see this program
    i am executing this program with out any event it is not showing any error but not giving output
    when i put start-of-selection then it is showing output
    *& Report  ZNNR_REPORT33
    REPORT  ZNNR_REPORT33 NO STANDARD PAGE HEADING MESSAGE-ID ZNNR LINE-SIZE 100 LINE-COUNT 65(4).
    ******DATA DECLARATIONS**********
    DATA : BEGIN OF IT_PLANT OCCURS 0,
            MATNR LIKE MARA-MATNR,
            WERKS LIKE MARC-WERKS,
            PSTAT LIKE MARC-PSTAT,
            EKGRP LIKE MARC-EKGRP,
           END OF IT_PLANT.
    DATA : BEGIN OF IT_PONO OCCURS 0,
            EBELN LIKE EKKO-EBELN,
            EBELP LIKE EKPO-EBELP,
            MATNR LIKE EKPO-MATNR,
            WERKS LIKE EKPO-WERKS,
            LGORT LIKE EKPO-LGORT,
           END OF IT_PONO.
    TABLES EKKO.
    ********END OF DATA DECLARATIONS*********
    ********SELECTION SCREEN DESIGN ***********
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETER : P_WERKS LIKE MARC-WERKS MODIF ID S1.
    SELECT-OPTIONS : S_EBELN FOR EKKO-EBELN NO INTERVALS MODIF ID S2.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-004.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS : R1 RADIOBUTTON GROUP G1 DEFAULT 'X' user-command uc1.
    SELECTION-SCREEN COMMENT 5(20) TEXT-002 FOR FIELD R1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS : R2 RADIOBUTTON GROUP G1.
    SELECTION-SCREEN COMMENT 5(20) TEXT-003 FOR FIELD R2.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK B2.
    ******END OF SELECTION SCREEN DESIGN****************
    ***********SCREEN MODIFICATIONS*******************
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF R1 EQ 'X' AND SCREEN-GROUP1 EQ 'S2'.
          SCREEN-INPUT = 0.
          MODIFY SCREEN.
        ENDIF.
        IF R2 EQ 'X' AND SCREEN-GROUP1 EQ 'S1'.
          SCREEN-INPUT = 0.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    ********END OF SCREEN MODIFICATIONS*****************
    ***************SCREEN VALIDATIONS *****************
    at selection-screen.
      SELECT SINGLE *
               FROM EKKO
               INTO EKKO
               WHERE EBELN IN S_EBELN.
      IF SY-SUBRC <> 0.
        SET CURSOR FIELD 'S_EBELN-LOW'.
        MESSAGE E999 WITH TEXT-005.
        clear S_ebeln-low.
      ENDIF.
    ********end of screen validation*****************
      IF R1 EQ 'X'.
    *ULINE AT /1(48).
        WRITE : SY-VLINE ,2 'MATERIAL NUMBER',
                21 SY-VLINE , 22 'PLANT',
                27 SY-VLINE , 28 'STATUS',
                43 SY-VLINE , 44 'GRUP', 48 SY-VLINE.
        ULINE AT /1(48).
      ENDIF.
      IF R2 EQ 'X'.
        WRITE : SY-VLINE , 2 'PO NUMBER',
               12 SY-VLINE, 13 'ITEM',
               18 SY-VLINE,19 'MATERIAL NUMBER',
               37 SY-VLINE, 38 'PLANT',
               44 SY-VLINE, 45 'GRUP',
               49 SY-VLINE.
        ULINE AT /1(50).
      ENDIF.
    start-of-selection.
    *set pf-status '100'.
      IF R1 EQ 'X'.
        SELECT MATNR
               WERKS
               PSTAT
               EKGRP
           FROM MARC
           INTO TABLE IT_PLANT
           WHERE WERKS = P_WERKS.
        LOOP AT IT_PLANT.
          WRITE : SY-VLINE , 2 IT_PLANT-MATNR COLOR COL_KEY,
                 21 SY-VLINE , 22  IT_PLANT-WERKS COLOR COL_KEY,
                 27 SY-VLINE ,28 IT_PLANT-PSTAT COLOR COL_NORMAL,
                 43 SY-VLINE ,44 IT_PLANT-EKGRP COLOR COL_NORMAL.
        ENDLOOP.
      ENDIF.
      IF R2 EQ 'X'.
        SELECT EBELN EBELP MATNR WERKS LGORT
               FROM EKPO
               INTO TABLE IT_PONO
               WHERE EBELN IN S_EBELN.
        LOOP AT IT_PONO.
          WRITE : SY-VLINE , 2 IT_PONO-EBELN COLOR COL_KEY,
                 12 SY-VLINE , 13 IT_PONO-EBELP COLOR COL_KEY,
                 18 SY-VLINE , 19 IT_PONO-MATNR COLOR COL_NORMAL,
                 37 SY-VLINE , 38 IT_PONO-WERKS COLOR COL_NORMAL,
                 44 SY-VLINE , 45 IT_PONO-LGORT COLOR COL_NORMAL, 49 SY-VLINE..
        ENDLOOP.
      ENDIF.
      ULINE AT /1(50).
      WRITE :/10 'PAGE NUMBER', SY-PAGNO, '/' ,SY-PAGNO.
      ULINE AT /1(50).
      WRITE :/10 'PAGE NUMBER', SY-PAGNO.

  • 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

  • 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?

  • 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

  • Importing to LR3.3 from Panasonic DMC-ZS3

    Sorry if this has been addressed. I couldn't find anything about it. Windows 7 Pro, 64bit, LR3.3, 2-SanDisk 2gb cards, RAW USB 2.0 UDMA reader Ever  since upgrading to LR3.3 I have not been able to Import files (jpg)  from my wifes SD cards straight

  • JScrollpane does not work properly when I interlinked to another Scrollpane

    Hi, I am trying to develop a small Editor using java Swing. I hav to display Line numbers also. for that i used another textarea and set the scrollbar model of that to the scrollbar model of text area where i type the programs. the module works perfe

  • Application open on dock but missing blue dot

    Often my application is open but on the dock the blue dot, to show the application is open, is not displayed.  Right now, Safari, Mail and Acrobat don't show the icon and in Safari's case of course it is open and active because I'm typing this in rig

  • Problem with Blacklight-settings

    I recently purchased my first IPod (30GB) and I'm having a problem with a couple of settings. The blacklight is set to switch on after 10 seconds and at the same time my Ipod starts playing music (even when the lock is on). Did I forget to change a s

  • BUTTON FOR PRINTING A RANGE OF PAGES

    I need to create a button that prints only a specific range of pages. So far I´ve been using this script: >this.print (false, this.pageNum, this.pageNum); >// print a file silently >this.print({bUI:false,bSilent:true,bShrinkToFit:true}); But the butt