Javascript alert problem - select state

I am trying to validate my form with javascript. I'm having
trouble with my state field. If the user selects a state javascript
alerts the following message: "SELECT ONE is not a valid choice.
Please choose your state." I want the alert message to pop up if
select one is selected as a state. How do I fix this problem?

pqer wrote:
> I am trying to validate my form with javascript. I'm
having trouble with my
> state field. If the user selects a state javascript
alerts the following
> message: "SELECT ONE is not a valid choice. Please
choose your state." I want
> the alert message to pop up if select one is selected as
a state. How do I fix
> this problem?
>
>
>
> <script language="javascript"
type="text/javascript">
>
> // check to see if the form is blank
> function validForm(contactUs) {
>
>
> if(contactUs.state.value != "SELECT ONE") {
> alert("SELECT ONE is not a valid choice. Please choose
your state.")
> contactUs.state.focus()
> return false
> }
if(!contactUs.state.selectedIndex) {
alert("SELECT ONE is not a valid choice. Please choose your
state.");
contactUs.state.focus();
return false;
Mick
>
> </script>
>

Similar Messages

  • Javascript and sql select statement

    I am working in html db in the 10 g environment. I'm trying to create an "auto suggestion function" that predicts values as the user enters characters into a text field. I've gotten it to work by hard coding the values in the function, ie: states. btw: there are several external javascript files at work here.
    What I want is to create a dynamic link to the database to gather, say, all names of providers at the time the page is built to use in the auto suggest format. I want to put this into a javascript routine and I'm having problems finding out how to mix the sql select statement into the javascript function.
    For the states example, I'm using:
    function StateSuggestions() {
    this.states = [
    "Alabama", "Alaska", "Arizona", "Arkansas",
    "California", "Colorado", "Connecticut",..."Wyoming" ];
    Can I substitute the hard coded data (states) with a sql select statement such
    as:
    select name from <dbtable> ???
    How does this need to be "wrapped" or containerized?
    Thank you. You have a great product in html db and your site is very useful. I appreciate everything you have done to assist us. Again, thank you.

    Hi,
    You can use TRUNC with 2 arguments to get the first DATE in a month, year, quarter, week, hour, minute, ISO year, ...
    SELECT  TRUNC ( ADD_MONTHS ( SYSDATE
                               , 12
                  , 'MONTH'
                  )     AS first_of_month
    FROM    dual
    ;The DATE returned will be in the same month, year, quearter, ... as the first argument.
    \We convered the last day of the month in [your previous question|http://forums.oracle.com/forums/message.jspa?messageID=3942939#3942939].
    At that time, I warded about using LAST_DAY as a cutoff point; TRUNC is a much better way.
    For example, to find all appointment_dates in the current month next year:
    SELECT  *
    FROM    appointments
    WHERE   appointment_date >= TRUNC (ADD_MONTHS (SYSDATE, 12), 'MONTH')
    AND     appointment_date <  TRUNC (ADD_MONTHS (SYSDATE, 13), 'MONTH')Note that
    the first part of the WHERE clause calls for dates on or equal to the beginning of the 12th month in the future, but
    the second part of the WHERE clause calls for dates before, not equal to , the beginning of the 13th month in the future.

  • Coldfusion with javascript alert problem with apostrophe

    Hi
    I have alert ("thanks for sing up #fname# - #lname# ")
    but fname='Charles's
    lanme ='Charles's'
    so javascript is not interpret with apostrophe . how can i
    resolve it thanks

    JSStringFormat()
    http://livedocs.adobe.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?cont ext=ColdFusion_Documentation&file=00000543.htm

  • Passing values to OnDemandProcess from Select Statement on Reports Page

    I think I'm just missing some of the proper syntax, Can somebody please help me.
    As I've come to understand this process of passing the values,
    I recognize it as (3) steps.
    1. Referencing the "javascript" in the Select Statement of the Reports Page.
    2. Including the "javascript" in the Page Header region.
    3. Defining the Process as an OnDemand Application Process.
    My problem is:
    a. I can't seem to get the Value passed to the Application Process.
    b. I don't know how to reference the Value passed once I get it passed.
    Here's what I've got done so far:
    1. (The Select Statement)
       onClick="javascript:ORDER_CONNECT_SEQUENCE('||ID||')
    {code}
    2. (The javascript)
    {code}
    function ORDER_CONNECT_SEQUENCE('+ID+')
    var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=ORDER_CONNECT_SEQUENCE',0);
    get.add('+ID+');
    gReturn = get.get('+ID+');
    {code}
    3. (The Application Process)
    {code}
       BEGIN
       Select '+ID+' into THIS_CIRCUIT from dual;
    {code}
    I Know that the Application Process is being referenced and that the OnClick routine is working properly,
    because if I plug a Value into the Application Process, instead of using '+ID+',
    Then I get all of my desired results.
    Any help you can give me here is greatly appreciated.
    Thanks- Gary                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Dimitri, Thanks for your efforts here, but its still not working for me.
    Here's what I understand from your suggestions:
    1. (changes to the javascipt)
       a. replace function ORDER_CONNECT_SEQUENCE('+ID+')
           with
           function ORDER_CONNECT_SEQUENCE(pId)
       b. replace get.add('+ID+')
           with
           get.addParam('x01',pId)
       c. replace getReturn = get.get('+ID+')
          with
          getReturn = get.get()
          get = null2. (chages to the Application Process)
       a. add l_value varchar2(4000) to my list of declarations
       b. add l_value := wwv_flow.g_x01 below the begin statement
       c. I guess then I would reference the l_value like this:
           Select l_value into THIS_CIRCUIT from dual* Also, You didn't mention any changes in my Select statement in the Reports region of the page.
    FYI.
      onClick="javascript:ORDER_CONNECT_SEQUENCE('||ID||')
    {code}
      The 'ID' which I'm referencing here is an ID from the table which I'm querying.
    Am I misunderstanding you somewhere?
    Thanks- gary                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Change the class and type in javascript or select statement of region

    Application Express 3.2.0.00.27
    I have a manually created tabular form where I need pk to be updatable or not not updateable depending on whether its a new record or not.
    I am attempting this thru 2 different ways.
    1st:
    using decode in select statement of region:
    SELECT decode(c001,NULL,APEX_ITEM.POPUP_FROM_LOV(15,c001,'AUTH_LOV',NULL,NULL,0,NULL,NULL,NULL,'YES','f15_' || '#ROWNUM#'),
    apex_item.display_and_save(15,c001,'f15_'|| '#ROWNUM#')) authid,
    apex_item.hidden(16, c002, NULL,'f16_'|| '#ROWNUM#') empid,
    -- apex_item.display_and_save(16,c002,'f16_'|| '#ROWNUM#') empid,
    apex_item.date_popup(17, rownum, c003, 'DD-MON-YYYY',20,2000,NULL,'f17_' || '#ROWNUM#')deldate,
    apex_item.textarea(18,c004,5,40,NULL,'f18_'|| '#ROWNUM#') "Delegation scope",
    apex_item.textarea(19,c005,5,40,NULL,'f19_'|| '#ROWNUM#')"Delegation limits",
    apex_item.select_list_from_lov(20,c006,'YESNO_LOV',NULL,'NO','N','%','f20_'|| '#ROWNUM#')"ORA Signed",
    apex_item.date_popup(21, rownum, c007, 'DD-MON-YYYY', 20,2000,NULL,'f21_' || '#ROWNUM#') "Del expiry",
    apex_item.date_popup(22, rownum, c008, 'DD-MON-YYYY', 20,2000,NULL,'f22_' || '#ROWNUM#') "Date removed",
    apex_item.textarea(23,c009,5,40,NULL,'f23_'|| '#ROWNUM#') "Delegation comments",
    apex_item.POPUP_FROM_LOV(24,c010,'DELEGATION_LOV',NULL,NULL,0,NULL,NULL,NULL,'YES','f24_' || '#ROWNUM#') "Delegator",
    apex_item.display_and_save(25,c011,'f25_'|| '#ROWNUM#') status,
    -- apex_item.display_and_save(26,seq_id,'f26_'|| '#ROWNUM#') seq_id,
    apex_item.hidden(26, seq_id,NULL,'f26_'|| '#ROWNUM#') ||
    apex_item.checkbox(27, seq_id,NULL,NULL,':','f27_'|| '#ROWNUM#') chkbx
    FROM apex_collections
    WHERE collection_name = 'DELEG_COLL'
    AND c011 IN ('O','N','U','D')
    --order by c001However this approach yields this error when I try to pick a value from the lov:
    Error: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus.
    My other approach is to attempt to change the type and class in javascript. I am trying this but I get an error when I attempt to change the class and type like this:
    <script type="text/javascript">
    <!--
    /* Client side validation on the Salary column */
    function changeProp(pCol) {
       var elms = document.getElementsByName(pCol);
       for (i=0; i< elms.length; i++) {
    /*       elms.style.backgroundColor = 'yellow'; */
    if (elms[i].value == null || elms[i].value == '%null%'
    || elms[i].value == '') {
    elms[i].class = 't20data';
    elms[i].type = 'hidden';
    alert('The value is' + elms[i].value);
    //-->
    </script>

    not completely duplicate...here in this thread I am stressing what I am trying to accomplish and asking for help on the javascript side.

  • Problem with Select Statements

    Hi All,
    I have a performance problem for my report because of the following statements.
    How can i modify the select statements for improving the performance of the report.
    DATA : shkzg1h  LIKE bsad-shkzg,
             shkzg1s  LIKE bsad-shkzg,
             shkzg2h  LIKE bsad-shkzg,
             shkzg2s  LIKE bsad-shkzg,
             shkzg1hu LIKE bsad-shkzg,
             shkzg1su LIKE bsad-shkzg,
             shkzg2hu LIKE bsad-shkzg,
             shkzg2su LIKE bsad-shkzg,
             kopbal1s  LIKE bsad-dmbtr,
             kopbal2s  LIKE bsad-dmbtr,
             kopbal1h  LIKE bsad-dmbtr,
             kopbal2h  LIKE bsad-dmbtr,
             kopbal1su  LIKE bsad-dmbtr,
             kopbal2su  LIKE bsad-dmbtr,
             kopbal1hu  LIKE bsad-dmbtr,
             kopbal2hu  LIKE bsad-dmbtr.
    *These statements are in LOOP.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg1s , kopbal1s)
          FROM bsid
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'S'
           AND umskz EQ ''
         GROUP BY shkzg.
        ENDSELECT.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg1su , kopbal1su)
          FROM bsid
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'S'
           AND umskz IN zspgl
         GROUP BY shkzg.
        ENDSELECT.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg1h , kopbal1h)
          FROM bsid
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'H'
           AND umskz EQ ''
         GROUP BY shkzg.
        ENDSELECT.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg1hu , kopbal1hu)
          FROM bsid
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'H'
           AND umskz IN zspgl
         GROUP BY shkzg.
        ENDSELECT.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg2s , kopbal2s)
          FROM bsad
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'S'
           AND umskz EQ ''
         GROUP BY shkzg.
        ENDSELECT.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg2su , kopbal2su)
          FROM bsad
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'S'
           AND umskz IN zspgl
         GROUP BY shkzg.
        ENDSELECT.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg2h , kopbal2h)
          FROM bsad
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'H'
           AND umskz EQ ''
         GROUP BY shkzg.
        ENDSELECT.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg2hu , kopbal2hu)
          FROM bsad
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'H'
           AND umskz IN zspgl
         GROUP BY shkzg.
        ENDSELECT.

    >
    Siegfried Boes  wrote:
    > Please stop writing answers if you understrand nothing about database SELECTS!
    > All above recommendations are pure nonsense!
    >
    > As always with such questions, you must do an analysis before you ask! The coding itself is perfectly o.k., a SELECT with an aggregate and a GROUP BY can not be changed into a SELECT SINGLE or whatever.
    >
    > But your SELECTS mustr be supported by indexes!
    >
    > Please run SQL Trace, and tell us the results:
    >
    > I see 8 statements, what is the duration and the number of records coming back for each statement?
    > Maybe only one statement is slow.
    >
    > See
    > SQL trace:
    > /people/siegfried.boes/blog/2007/09/05/the-sql-trace-st05-150-quick-and-easy
    >
    >
    > Siegfried
    Nice point there Siegfried. Instead of giving constructive suggestion, people here give a very bad suggestion on using SELECT SINGLE combined with SUM and GROUP BY.
    I hope the person already look at your reply before he try using select single and wondering why he has error.
    Anyway, the most important thing is how many loop expected for those select statements?
    If you have like thousands of loop, you can expect a poor performance.
    So, you should also look at how many times the select statement is called and not only performance for each select statement when you're doing SQL trace.
    Regards,
    Abraham

  • Problem in jdbc select statement

    {{  public List dis(int getmodified,int getindex){
    List outerList=null;
    outerList=new ArrayList();
    List display=null;
    try{
         System.out.println("testing.....3");
    con=getconnection();
    pstmt= con.prepareStatement("SELECT title from newss where nno >(10*(?)) and nno <=(10*?)");
         pstmt.setInt(1,getmodified);
         pstmt.setInt(2,getindex);
         System.out.println("testing.....2");
         //pstmt.setInt(1,pgno);
    rs=pstmt.executeQuery();
              while(rs.next())
                   display=new ArrayList();
                   display.add(rs.getString(1));
                   System.out.println("###########################" +rs.getString(1));
                   System.out.println("(((((((((((())))))))))" +display);
                   outerList.add(display);
    }catch(Exception e){
    System.out.println ("exception in select statement" +e.getMessage());
         System.out.println("*************" +outerList);
    return outerList;
    my problem is it says exception in select statement and no data found
    can someone resolve my problem}

    Check the below code snippet this what my fellow poster meant.check whether the proposed works well or not.
    public List dis(int getmodified,int getindex){
        List outerList = new ArrayList();
        List display=null;
         try{
              System.out.println("testing.....3");
              con = getconnection();
              pstmt = con.prepareStatement("SELECT title from newss where nno > ? and nno <= ?");
              pstmt.setInt(1,10*getmodified);
              pstmt.setInt(2,10*getindex);
              System.out.println("testing.....2");
              rs = pstmt.executeQuery();
              while(rs.next()){
                   display=new ArrayList();
                   String title = rs.getString(1);
                   display.add(title);
                  System.out.println("###########################" +title);
                  System.out.println("(((((((((((())))))))))" +display);
                  outerList.add(display);
       }catch(Exception e){
           e.printStackTrace();
       }finally{
           if(rs != null){
                 try{rs.close();}catch(Exception e){e.printStackTrace();}
           if(pstmt != null){
                   try{pstmt.close();}catch(Exception e){e.printStackTrace();}
           if(con != null){
                   try{con.close();}catch(Exception e){e.printStackTrace();}
            con = null;
            pstmt = null;
            rs = null;
       return outerList;
    REGARDS,
    RaHuL

  • Problem with Select statement.

    DATA: wa_usr05   TYPE usr05.
    The select statement always gives sy-subrc = 0
    even if there is no entry with parid = 'ZRD'.
    On successful it fills the structure wa_usr05 as
    MANDT     C     3      ACC
    BNAME     C     12      SCL
    PARID     C     20      X
    PARVA     C     18
    but mandt is 310.
    USR05 is a pool table and has mandt field.
            SELECT SINGLE bname
                          parid
                          parva
                FROM usr05
                INTO wa_usr05
                WHERE bname = sy-uname AND
                      parid = 'ZRD'    AND
                      parva = 'x'  OR  parva = 'X'.
    Let me know the reason and solution to the problem.

    SELECT SINGLE * FROM usr05
    INTO wa_usr05
    WHERE bname = sy-uname AND
    parid = 'ZRD' AND
    parva = <b>'X'</b> .
    Use single * as u have defined the wa+usr05 as usr05.
    Else.
    DATA: i_usr05 TYPE STANDARD TABLE of usr05.
    SELECT * FROM USR05
             INTO TABLE usr05
             WHERE bname = sy-uname AND
             parid = 'ZRD' AND
            parva = <b>'X'</b> .
    Then loop at itab and write data.
    Hope this solves ur query.
    Reward points if this helps.
    Message was edited by:
            Judith Jessie Selvi

  • Performance problem(ANEA/ANEP table) in Select statement

    Hi
    I am using below select statement to fetch data.
    Does the below where statement have performance issue?
    can you Pls suggest.
    1)In select of ANEP table, i am not using all the Key field in where condition. will it have performance problem?
    2)does the order of where condition should be same as in table, if any one field order change also will have effect performance
    SELECT bukrs                           
             anln1                          
             anln2                          
             afabe                          
             gjahr                        
             peraf                         
             lnran                         
             bzdat                          
             bwasl                        
             belnr                         
             buzei                         
             anbtr                       
             lnsan                         
        FROM anep
        INTO TABLE o_anep
        FOR ALL ENTRIES IN i_anla
       WHERE bukrs = i_anla-bukrs          
         AND anln1 = i_anla-anln1          
         AND anln2 = i_anla-anln2          
         AND afabe IN s_afabe              
         AND bzdat =< p_date                
         AND bwasl IN s_bwasl.              
      SELECT bukrs      
             anln1      
             anln2      
             gjahr      
             lnran       
             afabe      
             aufwv       
             nafal   
             safal       
             aafal      
             erlbt    
             aufwl      
             nafav    
             aafav     
             invzv   
             invzl      
        FROM anea
        INTO TABLE o_anea
        FOR ALL ENTRIES IN o_anep
       WHERE bukrs = o_anep-bukrs    
         AND anln1 = o_anep-anln1    
         AND anln2 = o_anep-anln2    
         AND gjahr = o_anep-gjahr    
         AND lnran = o_anep-lnran   
         AND afabe = o_anep-afabe.
    Moderator message: Please Read before Posting in the Performance and Tuning Forum
    Edited by: Thomas Zloch on Aug 9, 2011 9:37 AM

    1. Yes. If you have only a few primary keys in youe WHERE condition that does affect the performance. But some times requirement itself may be in that way. We may not be knowing all the primary keys to given them in WHER conditon. If you know the values, then provide them without fail.
    2. Yes. It's better to always follow the sequence in WHERE condition and even in the fields being fetched.
    One important point is, whenever you use FOR ALL ENTRIES IN, please make sure that the itab IS NOT INITIAL i.e. the itab must have been filled in. So, place the same conditin before both the SELECT queries like:
    IF i_anla[] IS NOT INITIAL.
    SELECT bukrs                           
             anln1                          
             anln2                          
             afabe                          
             gjahr                        
             peraf                         
             lnran                         
             bzdat                          
             bwasl                        
             belnr                         
             buzei                         
             anbtr                       
             lnsan                         
        FROM anep
        INTO TABLE o_anep
        FOR ALL ENTRIES IN i_anla
       WHERE bukrs = i_anla-bukrs          
         AND anln1 = i_anla-anln1          
         AND anln2 = i_anla-anln2          
         AND afabe IN s_afabe              
         AND bzdat =< p_date                
         AND bwasl IN s_bwasl.              
    ENDIF.
    IF o_anep[] IS NOT INITIAL.
      SELECT bukrs      
             anln1      
             anln2      
             gjahr      
             lnran       
             afabe      
             aufwv       
             nafal   
             safal       
             aafal      
             erlbt    
             aufwl      
             nafav    
             aafav     
             invzv   
             invzl      
        FROM anea
        INTO TABLE o_anea
        FOR ALL ENTRIES IN o_anep
       WHERE bukrs = o_anep-bukrs    
         AND anln1 = o_anep-anln1    
         AND anln2 = o_anep-anln2    
         AND gjahr = o_anep-gjahr    
         AND lnran = o_anep-lnran   
         AND afabe = o_anep-afabe.
    ENDIF.

  • Problem - Creating a Dynamic LOV using duplicate value in select statement

    I am trying to create a Dynamic LOV by attempting to follow a pattern similar to the following:
    select shop_name d, shop_id r
    from shops
    order by 1
    However, I want to use the shop_name twice as in the following because I do not have any other unique identifier available such as a shop_id to associate with the shop name:
    select shop_name d, shop_name r
    from shops
    order by 1
    But I get an error where I am not allowed to duplicate the shop_name in the select statement. I read somewhere on this forum where it can be done but I can't find exactly how.
    Can someone tell or show me how to accomplish this?
    Thanks in anticipation for your answer.
    Thanks,
    Ric

    Ric,
    I just tried to do this on APEX 3.0, and it worked just fine with this SQL:
    select ename d, ename r from emp order by 1Perhaps you could put an example on apex.oracle.com or specify the error message that you're getting.
    So as long as you have uniquely aliased both columns, this should not present a problem.
    Thanks,
    - Scott -

  • Facing problem in select statement dump DBIF_RSQL_INVALID_RSQL CX_SY_OPEN_S

    Hi Experts,
    I  am facing the problem in the select statement where it giving the short dump
    DBIF_RSQL_INVALID_RSQL CX_SY_OPEN_S.
    i have searched many forms, but i found that the select option s_matnr have the limitaion 2000 entreis, but i am passing same s_matnr to other select statement with more than 2000 entries but it is not giving me any short dump.
    but i am facing problem with only one select statement where if i  pass select option s_matnr more than 1500 entris also giving short dump.
    my select statement is
    SELECT * FROM bsim                                       
             INTO CORRESPONDING FIELDS OF TABLE g_t_bsim_lean  
               FOR ALL ENTRIES IN t_bwkey   WHERE  bwkey = t_bwkey-bwkey
                                            AND    matnr IN matnr
                                            AND    bwtar IN bwtar
                                            AND    budat >= datum-low.
    in the internal table g_t_bsim_lean internal table contain all the fields of the table bsim with 2 fields from other table.
    Please let me know whether i need to change the select statement or any other solution for this.
    Regards,
    udupi

    my select query is like this:
    DATA: BEGIN OF t_bwkey OCCURS 0,                          "184465
              bwkey LIKE bsim-bwkey,                            "184465
            END OF t_bwkey.                                     "184465
      LOOP AT g_t_organ          WHERE  keytype  =  c_bwkey.
        MOVE g_t_organ-bwkey     TO  t_bwkey-bwkey.
        COLLECT t_bwkey.                                        "184465
      ENDLOOP.                                                  "184465
      READ TABLE t_bwkey INDEX 1.                               "184465
      CHECK sy-subrc = 0.                                       "184465
      SELECT * FROM bsim                                        "n443935
             INTO CORRESPONDING FIELDS OF TABLE g_t_bsim_lean   "n443935
               FOR ALL ENTRIES IN t_bwkey   WHERE  bwkey = t_bwkey-bwkey
                                            AND    matnr IN matnr
                                            AND    bwtar IN bwtar
                                            AND    budat >= datum-low.

  • Problem with SELECT statement. What is wrong with it?

    Why is this query....
    <cfquery datasource="manna_premier" name="kit_report">
    SELECT Orders.ID,
           SaleDate,
           Orders.UserID,
        Distributor,
        DealerID,
        Variable,
        TerritoryManager,
        US_Dealers.ID,
           DealerName,
        DealerAddress,
        DealerCity,
        DealerState,
        DealerZIPCode,
        (SELECT SUM(Quantity)
         FROM ProductOrders PO
         WHERE PO.OrderID = Orders.ID) as totalProducts,    
    FROM Orders, US_Dealers
    WHERE US_Dealers.ID = DealerID AND SaleDate BETWEEN #CreateODBCDate(FORM.Start)# AND #CreateODBCDate(FORM.End)# AND Variable = '#Variable#'
    </cfquery>
    giving me this error message...
    Error Executing Database Query.
    [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.
    The error occurred in D:\Inetpub\mannapremier\kit_report2.cfm: line 20
    18 :              WHERE PO.OrderID = Orders.ID) as totalProducts,        
    19 : FROM Orders, US_Dealers
    20 : WHERE US_Dealers.ID = DealerID AND SaleDate BETWEEN #CreateODBCDate(FORM.Start)# AND #CreateODBCDate(FORM.End)# AND Variable = '#Variable#'
    21 : </cfquery>
    22 :
    SQLSTATE
      42000
    SQL
       SELECT Orders.ID, SaleDate, Orders.UserID, Distributor, DealerID, Variable, TerritoryManager, US_Dealers.ID, DealerName, DealerAddress, DealerCity, DealerState, DealerZIPCode, (SELECT SUM(Quantity) FROM ProductOrders PO WHERE PO.OrderID = Orders.ID) as totalProducts, FROM Orders, US_Dealers WHERE US_Dealers.ID = DealerID AND SaleDate BETWEEN {d '2009-10-01'} AND {d '2009-10-31'} AND Variable = 'Chick Days pre-book'
    VENDORERRORCODE
      -3504
    DATASOURCE
      manna_premier
    Resources:
    I copied it from a different template where it works without error...
    <cfquery name="qZVPData" datasource="manna_premier">
    SELECT UserID,
           TMName,
        UserZone,
              (SELECT COUNT(*)
               FROM Sales_Calls
               WHERE Sales_Calls.UserID = u.UserID) as totalCalls,
        (SELECT COUNT(*)
         FROM Orders
         WHERE Orders.UserID = u.UserID) as totalOrders,
        (SELECT SUM(Quantity)
         FROM ProductOrders PO
         WHERE PO.UserID = u.UserID AND PO.NewExisting = 1) as newItems,
        (SELECT SUM(NewExisting)
         FROM  ProductOrders PO_
         WHERE PO_.UserID = u.UserID) as totalNew,
        SUM(totalOrders)/(totalCalls) AS closePerc
    FROM Users u
    WHERE UserZone = 'Central'
    GROUP BY UserZone, UserID, TMName
    </cfquery>
    What is the problem?

    It's hard to say: what's your request timeout set to?
    700-odd records is not much of a fetch for a decent DB, and I would not expect that to case the problem.  But then you're using Access which doesn't fit the description of "decent DB" (or "fit for purpose" or "intended for purpose"), so I guess all bets are off one that one.  If this query is slow when ONE request is asking for it, what is going to happen when it goes live and multiple requests are asking for it, along with all the other queries your site will want to run?  Access is not designed for this.  It will really struggle, and cause your site to run like a dog.  One that died serveral weeks ago.
    What else is on the template?  I presume you're doing something with the query once you fetch it, so could it be that code that's running slowly?  Have you taken any steps to isolate which part of the code is taking so long?
    How does the query perform if you take the subquery out of the select line?  Is there any other way of getting that data?  What subquery will be running once for every row of the result set... not very nice.
    Adam

  • Problem in Matrix Like Select Statement.

    Hi All,
    I have table like this
    Name Null? Type
    ROLL NUMBER
    DD DATE
    ATT VARCHAR2(2)
    Along with the data--
    SELECT * FROM ATT;
    ROLL DD AT
    2 02-FEB P
    2 01-FEB P
    2 03-FEB P
    2 04-FEB P
    2 05-FEB P
    2 06-FEB P
    2 07-FEB A
    2 09-FEB A
    1 01-FEB A
    1 02-FEB P
    1 03-FEB A
    1 04-FEB A
    1 05-FEB P
    1 06-FEB P
    1 07-FEB P
    1 09-FEB P
    I want to write the select statement which fetch the data in matrix like I shown below.
    ROLL 01-FEB = 02-FEB = 03-FEB = 04-FEB
    1 A P A A
    2 P P P P
    I tried with sub-queries but not working Any Help...
    SKM

    sorry i did not look at the problem complete.
    the first solution works with the number of values in the date columns are known.
    then you can hardcode them , but when the values are unknown you should use something like this.
    i have given my example, you just change the queries in the code accordingly and it works great. Thanks to Thomas Kyte who provided this example, i took it and modified for my own.
    CREATE TABLE TABL_RESULTDATA
    Loadpoints VARCHAR2(125)
    , LoadPointSteps VARCHAR2(125)
    , Variable VARCHAR2(125)
    , Step NUMBER
    , Value NUMBER
    , VariableType VARCHAR2(20)
    , ReadBackValue NUMBER
    insert into tabl_resultdata values('HA_000_LP_000','S_001', 'AD1Out(ADcard_1)',1,5, 'SET', 10)
    insert into tabl_resultdata values('HA_000_LP_000','S_001','N',1,100,'SET', 10)
    insert into tabl_resultdata values('HA_000_LP_000','S_001','Load(DDE)',1,1,'SET', null)
    insert into tabl_resultdata values('HA_000_LP_000','S_002','Q_quer(Emi2)',1,9.5,'MEAS', null)
    insert into tabl_resultdata values('HA_000_LP_000','S_002','T_I(Emi2)',1,0,'MEAS', null)
    insert into tabl_resultdata values('HA_000_LP_000','S_002','AD1Out(ADcard_1)',1,0,'SET', null)
    insert into tabl_resultdata values('HA_000_LP_000','S_002','N',1,100,'SET', null)
    insert into tabl_resultdata values('HA_000_LP_000','S_002','Load(DDE)',1,1,'SET', null)
    insert into tabl_resultdata values('HA_000_LP_001','S_001','Q_Ueber(KMM)',1,49.83,'MEAS', null)
    insert into tabl_resultdata values('HA_000_LP_001','S_001','T_Volkor(KMM)',1,0,'MEAS', null)
    insert into tabl_resultdata values('HA_000_LP_001','S_001','C1(LeCroy)',1,0,'MEAS', null)
    insert into tabl_resultdata values('HA_000_LPSCHL_000','S_001','AD1Out(ADcard_1)',1,10,'SET', null)
    insert into tabl_resultdata values('HA_000_LPSCHL_000','S_001','AD1Out(ADcard_1)',2,12,'SET', 17)
    insert into tabl_resultdata values('HA_000_LPSCHL_000','S_001','AD1Out(ADcard_1)',3,12,'SET', 19)
    insert into tabl_resultdata values('HA_000_LPSCHL_000','S_001','AD1(ADcard_1)',1,9.025,'MEAS', null)
    insert into tabl_resultdata values('HA_000_LPSCHL_000','S_001','AD1(ADcard_1)',2,9.05,'MEAS', null)
    create or replace package pivot
    as
    type rc is ref cursor;
    procedure data(p_cursor in out rc);
    end;
    create or replace package body pivot
    as
    procedure data( p_cursor in out rc )
    is
    l_stmt long;
    l_index number := 0;
    begin
    l_stmt := 'select loadpoints, loadpointsteps ,step ';
    for x in ( select distinct variable, variabletype from tabl_resultdata order by 2 )
    loop
    l_index := l_index + 1;
    l_stmt := l_stmt ||', max(decode(variable,' || ''''|| x.variable||''''||', value )) ' ||replace(replace(x.variable||'('||x.variabletype||')', '('), ')');
    end loop;
    l_stmt := l_stmt || ' from tabl_Resultdata group by loadpoints,loadpointsteps, step order by loadpoints';
    open p_cursor for l_stmt;
    end;
    end;
    set linesize 198
    column loadpoints format a17
    column loadpointsteps format a5
    column step format 999
    column value_1 format 999.999
    column value_2 format 999.999
    column value_3 format 999.999
    column value_4 format 999.999
    column value_5 format 999.999
    column value_6 format 999.999
    column value_7 format 999.999
    column value_8 format 999.999
    column value_9 format 999.999
    variable x refcursor
    set autoprint on
    exec pivot.data( :x );

  • Cascading Select Statements - problem with blank drop-downs

    Hello,
    I have posted a number of questions about Cascading Select Statements in APEX and though I've received some good information, I still get a blank drop-down when I select the first LOV.
    I also found "How to test an On-Demand Process used for AJAX" on the web. Here is the link to the web page:
    http://www.inside-oracle-apex.com/2006/12/how-to-test-on-demand-process.html
    When I try to test the ON-DEMAND Application Process in the Address Bar of my browser by typing the following, I get an error:
    http://beta.biztech.net:2020/pls/apex/f?p=4000:0:211233229176642:APPLICATION_PROCESS=CASCADING_SELECT_LIST:::P6_PROJECT_ID:CASCADING_SELECTLIST_ITEM_1
    The error I get is:
    Unexpected error, unable to find item name at application or page level.
    ERR-1002 Unable to find item ID for item "P6_PROJECT_ID" in application "4000".
    As perhaps a last ditch effort, I will post all the steps, all the code and a link to my application.
    Here is a link you can visit to view my application:
    http://beta.biztech.net:2020/pls/apex/f?p=112:1
    You can log in with the following ID and Password
    ID: tsimkiss
    PW: TS92
    Here are the steps that I have followed and the code that I have used.
    ++++++++++++++++++++++++++++++++++++++++++++++++++
    1. Create an application process in Shared Components
    - On Demand CASCADING_SELECT_LIST - like this:
    Process Point: On Demand
    Name: CASCADING_SELECT_LIST
    TYPE: PL/SQL Anonymous Block
    BEGIN
    OWA_UTIL.mime_header ('text/xml', FALSE);
    HTP.p ('Cache-Control: no-cache');
    HTP.p ('Pragma: no-cache');
    OWA_UTIL.http_header_close;
    HTP.prn ('<select>');
    HTP.prn ('<option value="' || 1 || '">' || '- select tasks -' || '</option>');
    FOR c IN (SELECT newops.task_name AS task_name,
    newops.task_id AS task_id
    FROM NEW_OPPORTUNITIES newops
    UNION
    SELECT DISTINCT pt.task_name AS task_name,
    pt.task_id AS task_id
    FROM pa_tasks@bizdev pt,
    pa.pa_projects_all@bizdev prj
    WHERE prj.project_id = pt.project_id
    AND prj.project_id =
    CASE
    WHEN TO_NUMBER(:cascading_selectlist_item_1)=1
    THEN prj.project_id
    ELSE TO_NUMBER(:cascading_selectlist_item_1)
    END)
    LOOP
    HTP.prn ('<option value="' || c.task_id || '">' || c.task_name || '</option>');
    END LOOP;
    HTP.prn ('</select>');
    END;
    2. Create an application item in Shared Components:
    Name: CASCADING_SELECTLIST_ITEM_1
    3. Create an LOV in Shared Components
    - This is the Primary LOV (name it similar to it's select list page item):
    List of Values Name: PROJECT_ID
    Source: Lists of Values Query
    SELECT newops.CLIENT AS project_name, newops.PROJECT_ID AS project_id FROM NEW_OPPORTUNITIES newops
    UNION
    SELECT ppa.NAME AS project_name, ppa.PROJECT_ID AS project_id FROM pa.pa_projects_all@bizdev ppa
    WHERE ppa.project_status_code='APPROVED'
    AND (ppa.COMPLETION_DATE IS NULL or ppa.completion_date > sysdate)
    AND (ppa.CLOSED_DATE IS NULL or ppa.closed_date > sysdate)
    ORDER BY project_name asc
    4. Create a javascript and put it in the header of the page where cascading drop-downs are:
    <script>
    function get_select_list_xml(pThis,pSelect){
    var l_Return = null;
    var l_Select = html_GetElement(pSelect);
    var get = new htmldb_Get(null,html_GetElement('pFlowId').value,
    'APPLICATION_PROCESS=CASCADING_SELECT_LIST',0);
    get.add('CASCADING_SELECTLIST_ITEM_1',pThis.value);
    gReturn = get.get('XML');
    if(gReturn && l_Select){
    var l_Count = gReturn.getElementsByTagName("option").length;
    l_Select.length = 0;
    for(var i=0;i<l_Count;i++){
    var l_Opt_Xml = gReturn.getElementsByTagName("option");
    appendToSelect(l_Select, l_Opt_Xml.getAttribute('value'),
    l_Opt_Xml.firstChild.nodeValue)
    get = null;
    function appendToSelect(pSelect, pValue, pContent) {
    var l_Opt = document.createElement("option");
    l_Opt.value = pValue;
    if(document.all){
    pSelect.options.add(l_Opt);
    l_Opt.innerText = pContent;
    }else{
    l_Opt.appendChild(document.createTextNode(pContent));
    pSelect.appendChild(l_Opt);
    </script>
    5. Create two Select List page items:
    P6_PROJECT_ID <-- This is the primary drop-down
    P6_TASK_ID <-- This is the secondary drop-down
    6. In your primary select list, put the following into HTML Form Element Attributes:
    HTML Form Element Attributes: onchange="get_select_list_xml(this,'P6_TASK_ID')"
    Other settings on the page:
    Name: P6_PROJECT_ID
    Display As: Select List
    Source Used: Always, replacing any existing values in session state
    Source Type: Database Column
    Source value or expression: PROJECT_ID
    Named LOV: PROJECT_ID <--- Choose from drop-down (this is the Application LOV created earlier)
    Null display values: - select project -
    Display Null: Yes
    7. The second select list is based on an LOV and depends on the value of the first select list:
    Name: P6_TASK_ID
    Display As: Select List
    Source Used: Always, replacing any existing values in session state
    Source Type: Database Column
    Source value or expression: TASK_ID
    Null display values: - select project -
    Display Null: Yes
    List of values definition:
    SELECT newops.task_name AS task_name,
    newops.task_id AS task_id
    FROM NEW_OPPORTUNITIES newops
    UNION
    SELECT DISTINCT pt.task_name AS task_name,
    pt.task_id AS task_id
    FROM pa_tasks@bizdev pt,
    pa.pa_projects_all@bizdev prj
    WHERE prj.project_id=pt.project_id
    AND prj.project_id=:P6_PROJECT_ID
    ORDER BY task_name asc
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    If you need an actual running copy of my application, I'm not sure I can upload to the Oracle APEX website since uses datalinks to some tables. If necessary, I will give you my login into if you email me directly, however.
    If someone could just straighten my code out especially on the ON-DEMAND Application Process, I think that would really help me out.
    Hope someone out there can help me.
    Thanks
    LEH

    Sorry, looking at your code that testing URL is still incorrect. You should be passing name / value pairs in the last arguments, and your passing P6_PROJECT_ID as the name part and CASCADING_SELECTLIST_1 as the value part. In your application process you are using CASCADING_SELECTLIST_1 as the parent ID for the P6_TASK_ID dropdown, so it is this name / value pair that you'll need to test. So your URL should look something like this...
    http://beta.biztech.net:2020/pls/apex/f?p=112:0:211233229176642:APPLICATION_PROCESS=CASCADING_SELECT_LIST:::CASCADING_SELECTLIST_ITEM_1:[some project id]
    (Note: Where [some project id] should be an ID for a project in your database, that has tasks.)
    And I'm with Dan here, I still can't access that link you provided. apex.oracle.com should be your next move if you can't resolve it, as you've got at least two people willing to go and have a look at your code.
    Hope it helps,
    Anthony.

  • Problem with select statement using Ranges

    Hi Guys,
                   I have used Ranges and used a select statement for selecting those ranges but I am facing a problem.
    RANGES: r_doctyp for EDIDC-DOCTYP.
    r_doctyp-sign = 'I'.
    r_doctyp-option = 'EQ'.
    r_doctyp-low  = 'DEBMAS'.
    append r_doctyp.
    r_doctyp-sign = 'I'.
    r_doctyp-option = 'EQ'.
    r_doctyp-low  = 'MATMAS'.
    append r_doctyp.
    r_doctyp-sign = 'I'.
    r_doctyp-option = 'EQ'.
    r_doctyp-low  = 'PRICAT'.
    append r_doctyp.
    r_doctyp-sign = 'I'.
    r_doctyp-option = 'EQ'.
    r_doctyp-low  = 'ORDERS'.
    append r_doctyp.
    r_doctyp-sign = 'I'.
    r_doctyp-option = 'EQ'.
    r_doctyp-low  = 'INVOIC'.
    append r_doctyp.
    Select DOCNUM                                " IDoc number
           DOCTYP                                " IDoc Type
                 from  EDIDC into table IT_ZEDIDC
                 where CREDAT EQ s_credat-low
                 and   DOCTYP EQ r_doctyp        " IDOC Types
                 and   DIRECT EQ '1'.
    Here my select statement is only taking INVOIC.
    But my statement should take any document type.
    Thanks,
    Prasad.

    Hi...,
    Your following select statement is correct.
    Select DOCNUM                                " IDoc number
                DOCTYP                                " IDoc Type
                from  EDIDC into table IT_ZEDIDC
                where CREDAT IN s_credat
                and   DOCTYP IN r_doctyp        " IDOC Types
                and   DIRECT EQ '1'.
    Why you are not getting result..
    1. structure of the IT_ZEDIDC is having two fields DOCNUM , DOCTYP  with same data lengths. If not it should be...
    2. Order in the database table is must be similer to the order you maintained in the select statement.
    3. As you are hard coding the input ranges make sure about every letter.
    4. take a look at other where condition fields too.
    5. check the table of the ranges in debugging mode.
    6. why can't you declare separate work area and table for ranges...?
      like .... data: r_tab type range of <field>
                 data: wa_tab like line of r_tab.
    7. Use clear work area statement after the append statment.
    --Naveen Inuganti.

Maybe you are looking for

  • Iphone 4s no longer plays music in my car!

    Last week I lost all my contacts, they disappeared, everything else is in tact. I decided to do the upgrade that itunes asked for on my 4s, now I cant play any songs in my car when I plug my phone into usb. Worked perfectly fine before. Sometimes a s

  • Where is the iPod playlist in iTunes?

    Hello dear members, I have a problem with my iTunes, could someone kindly help me please? My iPod is old. It's the 20GB black and white one from a long time ago. Recently, I bought a new laptop with Windows Vista on it, and I got iTunes version 7. It

  • MiniDP to HDMI issues after upgrading to 10.6.5.

    With 10.6.4, the only issue I was hoping to have fixed was adding the overscan slider adjustment that the mini has, but 10.6.5 completely broke my miniDP out. When plugging in the adapter, one of two things happens... either my tv doesn't recognize t

  • In OO Alv toolbar, sum and subsum buttons are disable as default, WHY ?

    i want to enable sum and subsum buttons in alv toolbar. However, as default those buttons are disable. How can i solve ?

  • [915 Series] My computer keeps freezing for no reson

    i just got the MSI 915G neo2 LGA 2.8 520 2x265 533 first i had trouble to install the windows then i disabled the lan on the board and installed the windows then i had trouble with installing the sound driver so i upgraded to SP2 and installed the dr