Hardcode value in sql statement

Hi,
This may be a simple thing which I'm missing.
I'm trying to hardcode numeric value in my SQL statement
'1.0000' AS NUMBER (10,4) - It returns value as 1 instead of 1.0000
'1.1255' AS NUMBER(10,4) - returns 1.1255
I need my o/p to be as 1.0000 not as 1.Is there anyway I can get the result as I'm looking for
Thanks in advance

Hi,
847750 wrote:
Hi,
This may be a simple thing which I'm missing.
I'm trying to hardcode numeric value in my SQL statement
'1.0000' AS NUMBER (10,4) - It returns value as 1 instead of 1.0000
'1.1255' AS NUMBER(10,4) - returns 1.1255
I need my o/p to be as 1.0000 not as 1.Is there anyway I can get the result as I'm looking for
Thanks in advance
It's hard to tell what you really want to do from such a tiny code fragment.
Whenever you have a question, post a complete test script that people can run to re-create the problem and test their ideas.
The value 1 is exactly the same as the value 1.0000; there is no difference between those numbers.
If you want to display a number in a certain format (e.g. '1.0000' instead of '1'), the front end is probably the best place to do that.
If you're using SQL*Plus as the front end, you can set the display for the column called increase_pct like this:
COLUMN  increase_pct  FORMAT 990.0000
This will make it display the numbers in that column with at least 1 digit to the left of the decimal point, and exactly 4 digits to the right of the decimal point.
Other front end tools have similar features.
If you need to do the equivalent in SQL, use the TO_CHAR function, like this
SELECT  ename
,       TO_CHAR (sal, '99999.00')   AS salary
FROM    scott.emp
If you really are hard-coding literals, you can hard code a string, such as '1.0000'.  Don't CAST it to a NUMBER..

Similar Messages

  • Variable vs hardcoded value in SQL query

    Hi Gurus,
    I have a SQL query inside a function that looks similar (i'm showing the "where" clause here only) to the below:
    WHERE ID = variable_id (by the way this two have exactly the same type, number(20))
    and
    WHERE ID = 100
    In the first option that uses variable it takes 4 secs to complete the query, while the second one that uses hardcoded value completes in milliseonds. Im new to oracle but been to other dbms and havent seen such behaviour. Anyone encountered or know what maybe the cause? I thought of not pasting here the explain plan since its just a question of variable vs hardcoded value.
    rgds.

    Just want to add something, here is the stats for the two queries:
    Statistics for variable_id (15 secs)
    29 recursive calls
    0 db block gets
    24324 consistent gets
    21556 physical reads
    0 redo size
    20676 bytes sent via SQL*Net to client
    613 bytes received via SQL*Net from client
    25 SQL*Net roundtrips to/from client
    17 sorts (memory)
    0 sorts (disk)
    358 rows processed
    Statistics for hardcoded value (5 secs)
    4 recursive calls
    0 db block gets
    2631 consistent gets
    0 physical reads
    0 redo size
    20469 bytes sent via SQL*Net to client
    613 bytes received via SQL*Net from client
    25 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    358 rows processed
    There are differences consistent gets and physical reads. What coul dbe the problem here?
    tnx!

  • Defaulting DFF Segment Value using sql statement in SSHR gives error when using parameter

    Dear All,
    i am having an issue that i am making one segment in DFF (SEGMENT3) being defaulted by using sql statement
    Select MAX(SEGMENT7) FROM PER_ANALYSIS_CRITERIA cri, PER_PERSON_ANALYSES ana where cri.Analysis_Criteria_id = ana.ANALYSIS_CRITERIA_ID and ana.PERSON_ID = :ANALYSES.PERSON_ID
    The Above Select Statement is working fine on the PUI form and getting the Default value correctly but when opening the SSHR page that contain this DFF, it  gives me the below error.
    "No field listener is registered to resolve field ANALYSES.PERSON_ID referenced by the flexfield with application short name PER and name PEA. Please contact your system administrator. "
    Any Help Please???

    Please see the following docs.
    Cannot Add Salary:No Field Listener is Registered to Resolve Field Review.assignment_id (Doc ID 558295.1)
    No Field Listener Is Registered To Resolve Field Assgt.Effective_start_date (Doc ID 889794.1)
    List of Current Enhancement Requests (ER) for Oracle EBS Self Service Human Resource (SSHR) (Doc ID 1381936.1)
    No field listener is registered to resolve field xxx.xxx referenced by the flexfield with application short name ASO... (Doc ID 1359270.1)
    Customer Form, Address Error: No field listener is registered to resolve field GLOB.FLEX_COUNTRY_CODE referenced by the flexfield with application short name AR (Doc ID 1276934.1)
    DFF issue : No Field Listener Is Registered To Resolve Field XXX Referenced By The Flexfield (Doc ID 555589.1)
    Thanks,
    Hussein

  • Parameter value in sql statement (Custom Folder)

    Hi ,
    I want to formulate a custom folder - consisting of a sql statement , inside of which there is a parameter. Then in Desktop , the users can select a number as the searching criteria and this value will replace the parameter in sql statement , as in the following:
    select CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE , SUM_POSOTITA from
    select CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE , SUM_POSOTITA , row_number() over (order by sum_posotita desc) rw  from
      (SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES ,SUM(POSOTITA) SUM_POSOTITA
              FROM  EKTELESI_AT_SINT_CLINIC A, MITROO_FARMAKOU B
               WHERE CODE_FARMAKOU = FARMAK_CODE
               GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS))
      where rw<=&p
      order by SUM_POSOTITA desc The problem is that the use of parameter , whereas in sql*plus is valid, in Discoverer is not....
    What can i do in this situation...????
    Thanks , a lot
    Simon

    However , a peculiar event happens....
    whereas the sql statement is:
    select CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE , SUM_POSOTITA,RW from
    select CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE , SUM_POSOTITA , row_number() over (order by sum_posotita desc) rw  from
      (SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES ,SUM(POSOTITA) SUM_POSOTITA
              FROM  EKTELESI_AT_SINT_CLINIC A, MITROO_FARMAKOU B
               WHERE CODE_FARMAKOU = FARMAK_CODE
               GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS
      UNION ALL
      SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES,SUM(POSOTITA) SUM_POSOTITA
              FROM  EKTELESI_AT_SINT_EX_IATR A, MITROO_FARMAKOU B
               WHERE CODE_FARMAKOU = FARMAK_CODE
               GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS
      UNION ALL
      SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES,SUM(POSOTITA) SUM_POSOTITA
              FROM  EKTELESI_AT_SINT_FOREON_MS A, MITROO_FARMAKOU B
               WHERE CODE_FARMAKOU = FARMAK_CODE
               GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS
      UNION ALL
      SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES,SUM(POSOTITA) SUM_POSOTITA
              FROM  EKTELESI_GEN_SINT_KLIN A, MITROO_FARMAKOU B
               WHERE CODE_FARMAKOU = FARMAK_CODE
               GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS
      UNION ALL
      SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES,SUM(POSOTITA) SUM_POSOTITA
              FROM  EKTELESI_GEN_SINT_EX_IATR A, MITROO_FARMAKOU B
               WHERE CODE_FARMAKOU = FARMAK_CODE
               GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS))
      order by RW ascand produces the results....
    CODE_FARMAKOU                            EMP_NAME                                                                         PACKTYPE                     PACKSIZE                  SUM_POSOTITA         RW
    1000003279                               MOXACEF                                                                          BT                           40(BLIST10X4)                       45          1
    0000014071                               DOPAMINE HYDROCHLORIDE                                                           VIAL                         5 ML X 25                           30          2
    1000016655                               KABIVEN                                                                          BT                           50ÖÕÓ.×1,7ML                        21          3
    1000014127                               DEPON VIT. C                                                                     BT                           2TUBX10                              6          4
    0000002419                               FACTREL INJECTION                                                                VIAL                         2 ML                                 5          5
    0000086289                               DETUSSIN EXPECTORANT                                                             BOT                          120 ML                               3          6
    1000016655                               KABIVEN                                                                          BT                           50ÖÕÓ.×1,7ML                         2          7
    1000014127                               DEPON VIT. C                                                                     BT                           2TUBX10                              2          8
    1000000760                               DEPON                                                                            BT                           20(BLIST2X10)                        2          9
    1000003279                               MOXACEF                                                                          BT                           40(BLIST10X4)                        1         10
    1000003279                               MOXACEF                                                                          BT                           40(BLIST10X4)                        1         11
    1000000760                               DEPON                                                                            BT                           20(BLIST2X10)                        1         12
    12 rows selectedIn Discoverer , even i select to see -as parameter- let's say the 10 first records, the system displays the 7 first records , whereas when i want to see the 1,2,3,4,5,6,7 first records the system works fine....and displays accordingly 1,2,3,4,5,6,7 first records. The problem occurs above the 8th record-as parameter selected..!!!!!
    I defined the parameter as :Rw<=:Rw
    What may be the problem...????
    SORRY!!!!! I FOUND THE PROBLEM ....!!!!
    Regards and many thanks,
    Simon
    Message was edited by:
    sgalaxy

  • Using passed values in SQL statements

    Using Adobe Livecycle Designer 7, we wish to populate a pdf document with values from a MS SQL database. The values will change depending on the ID of the record called for.
    We can already populate the form using SQL (SELECT firstname FROM names WHERE id = 1), but we need to populate it based on a 'passed' value in a url (http://www.mysite.com/mypdf.pdf?id=1).
    When we try to include this into the SQL (SELECT firstname FROM names WHERE id = request.id) we get an error. Could anyone provide us with the correct syntax that will allow us to populate the form based on the ID passed in a URL?
    Many Thanks
    Craig

    Hi all of you,
    I do have a problem with coding correctly a form I am designing sing the Adobe Livecycle . In one of the field, there is an underlying field that when you exit the first name field or the Middle Initial field or the last name, it should all pass the respective values to the underlying field which becomes visible on printout. I do have this code I wrote on the exit event, but do not understand why it it not working. Please, can anyone tell me why it is not working or help me out on a better way of making it work.
    xfa.host.messageBox("Check this");
    if (EMPFNAME.rawValue <> " " ){
    xfa.host.messageBox("EMPFNAME");
    EMPNAME.rawValue = String(EMPFNAME.rawValue) + " ";
    if (EMPFNAME.rawValue <> " " )&&(EMPMI.rawValue <> " "){
    EMPNAME.rawValue = String(EMPFNAME.rawValue) + " " + String(EMPMI.rawValue) + ".";
    var s = EMPMI.rawValue;
    EMPMI.rawValue = s.toUpperCase();
    if (EMPFNAME.rawValue <> " " )&&(EMPMI.rawValue <> " ")&&(EMPLNAME.rawValue <> " "){
    EMPNAME.rawValue = String(EMPFNAME.rawValue) + " " + String(EMPMI.rawValue) + "." + " " + String(EMPLNAME.rawValue);
    var s = EMPMI.rawValue;
    EMPMI.rawValue = s.toUpperCase();
    Thanks
    Lucky P

  • About sql statement in AM

    Using jdev11.1.1..5.0
    select 1 from dual where DUMMY = :pdummy ;@ run time if i give :pdummy as String X means i get an value 1
    so same try to do in AM.
        public void dummy(String pdummy)
                CallableStatement cs = null;
                try{
                String sql = "select 1 from dual where DUMMY = :pdummy ;" ;   
                cs =  getDBTransaction().createCallableStatement(sql,0);
                cs.registerOutParameter(1, Types.VARCHAR);
                cs.setString(2,pdummy ); 
                cs.executeUpdate();
                catch(SQLException e)
                throw new JboException(e);
                finally
                if (cs!=null)
                try
                cs.close();
                catch (Exception e){System.out.println ("Dummy Exception Thrown "+e);}
                }Error throwing such invalid index. can anyone re-correct me.

        public void dummy(String pdummy)
                    CallableStatement cs = null;
                    try{
                    String sql = "select 1 from dual where DUMMY = ?" ;   
                    cs =  getDBTransaction().createCallableStatement(sql,0);
                    cs.setString(1,pdummy );
                    System.out.println("ex"+ cs.execute());
                    catch(SQLException e)
                    throw new JboException(e);
                    finally
                    if (cs!=null)
                    try
                    cs.close();
                    catch (Exception e){System.out.println ("Dummy Exception Thrown "+e);}
                    }sir,
    thank you but..i want to see the value of sql statement. how can i see that?
    above code is working but i want to see the value.
    so i did like this.
        public String dummies(String pdummy)
                    CallableStatement cs = null;
                    try{
                    String sql = "select 1 from dual where DUMMY = ?" ;   
                    cs =  getDBTransaction().createCallableStatement(sql,0);
                    cs.setString(1,pdummy );
                    cs.execute();
                    return cs.getString(1);
                    catch(SQLException e)
                    throw new JboException(e);
                    finally
                    if (cs!=null)
                    try
                    cs.close();
                    catch (Exception e){System.out.println ("Dummy Exception Thrown "+e);}
                    }some invalid index error.. can show me way to see the value of sql statement.
    Edited by: subu123 on Apr 18, 2012 1:59 AM

  • @jc:sql statements

    hi. i had a question regarding return values of sql statements: i'm familiar with mapping return values from a SELECT statement into ResultSet objects, but what is returned when an INSERT or DELETE or UPDATE statement is performed? thanks.
    qin_23

    it's ok, i got it.
    qin__23

  • Returning sql statement instead of values from database

    hi am reading value from database but my problem is am get sql statement values instead of values in database
    my code is
    java:337)

    There is no doubt: you get what you want:
        return s_getValue;
    bye
    TPD

  • Exclude duplicate values on SQL where clause statement

    Hi!
    Are some posibilities to exclude duplicate values do not using sql aggregate functions in main select statement?
    Priview SQL statement
    SELECT * FROM
    select id,hin_id,name,code,valid_date_from,valid_date_to
    from diaries
    QRSLT
    WHERE (hin_id = (SELECT NVL(historic_id,id)FROM tutions where id=/*???*/ 59615))
    AND NVL(valid_date_to,to_date('22.12.2999','dd.mm.yyyy')) <= (SELECT NVL(valid_date_to,to_date('22.12.2999','dd.mm.yyyy'))FROM tutions where id= /*???*/ 59615)
    AND trunc(valid_date_from) >=(SELECT trunc(valid_date_from)FROM tutions where id= /*???*/ 59615)
    The result
    ID                  HIN_ID    NAME      CODE    VALID_DATE FROM                 VALID_DATE_TO    
    50512
    59564
    RE TU
    01
    07.06.2013 16:32:15
    07.06.2013 16:33:28
    50513
    59564
    TT2 
    02
    07.06.2013 16:33:23
    07.06.2013 16:33:28
    50515
    59564
    TT2 
    02
    07.06.2013 16:33:28
    07.06.2013 16:34:42
    50516
    59564
    ROD 
    03
    07.06.2013 16:34:37
    07.06.2013 16:34:42
    VALID_DATE_TO & AND VALID_DATE_FROM tutions
    07.06.2013 16:34:42
    15.07.2013 10:33:23
    In this case i got duplicate of entry TT2 id 50513  In main select statement cant use agregate functions are even posible to exclude this value from result modifying only the QLRST WHERE clause (TRUNC need to be here)
    THANKS FOR ANY TIP !
    ID.

    Hi, Ok this is working in this case
    SELECT * FROM
    select id,hin_id,name,code,valid_date_from,valid_date_to
    from diaries ahs
    QRSLT
    WHERE (hin_id = (SELECT NVL(historic_id,id)FROM aip_healthcare_tutions where id=/*???*/ 59615))
    AND NVL(valid_date_to,to_date('22.12.2999','dd.mm.yyyy')) <= (SELECT NVL(valid_date_to,to_date('22.12.2999','dd.mm.yyyy'))FROM tutions where id= /*???*/ 59615)
    AND trunc(valid_date_from) >=(SELECT trunc(valid_date_from)FROM tutions where id= /*???*/ 59615)
    AND NOT  EXISTS
    (SELECT null FROM diaries ahs WHERE  ahs.valid_date_from < QRSLT.valid_date_from
        AND QRSLT.hin_id=ahs.hin_id
        AND QRSLT.code=ahs.code);
    Result
    50512
    59564
    RE TU
    01
    07.06.2013 16:32:15
    07.06.2013 16:33:28
    50513
    59564
    TT2 
    02
    07.06.2013 16:33:23
    07.06.2013 16:33:28
    50516
    59564
    ROD 
    03
    07.06.2013 16:34:37
    07.06.2013 16:34:42
    But if the Data in tutions row  are theese(valid_date_to-null)  then NO ROWS are returning and its logical because in full result list Valid_date_from column are logical incorect
    valid_date_from                                 valid_date_to
    15.07.2013 10:33:23
    NULL
    ID                  HIN_ID    NAME      CODE    VALID_DATE FROM                 VALID_DATE_TO 
    50510
    59564
    RE TU
    01
    07.06.2013 16:33:28
    50511
    59564
    TT2 
    02
    07.06.2013 16:34:41
    50514
    59564
    ROD 
    03
    07.06.2013 16:34:41
    50520
    59564
    Params
    04
    03.07.2013 21:01:30
    50512
    59564
    RE TU
    01
    07.06.2013 16:32:15
    07.06.2013 16:33:28
    50513
    59564
    TT2 
    02
    07.06.2013 16:33:23
    07.06.2013 16:33:28
    50515
    59564
    TT2 
    02
    07.06.2013 16:33:28
    07.06.2013 16:34:42
    50516
    59564
    ROD 
    03
    07.06.2013 16:34:37
    07.06.2013 16:34:42
    Are that posible modifying where statement  if the valid_date_to in tutions are null then theese records where in diary valid_date_to is null is correct to, but need to stay previos logic
    D                  HIN_ID    NAME      CODE    VALID_DATE FROM                 VALID_DATE_TO 
    50510
    59564
    RE TU
    01
    07.06.2013 16:33:28
    null
    50511
    59564
    TT2 
    02
    07.06.2013 16:34:41
    null
    50514
    59564
    ROD 
    03
    07.06.2013 16:34:41
    null
    50520
    59564
    Params
    04
    03.07.2013 21:01:30
    null
    Thanks !
    ID.

  • Assigning values to 2 fields using sql statement

    db11g , apex 4.0 and firefox 24 ,
    hi all ,
    i am trying to follow this tutorial to assign values to 2 items on a page using sql statement ,
    and i am using the same sql statement the tutorial uses
    select d.loc location, count(e.empno) num_employees from dept d, emp e where d.deptno = e.deptno(+) and d.deptno = :P3_DEPTNO group by d.loc -- btw , what does the "+" sign mean?
    after the e.deptno in the where condition .
    but i am facing this error
    1 error has occurred
    Wrong number of columns selected in the SQL query. See Help of attribute for details.
    and it does not work with two columns in the select statement under any conditions , i tried to remove the group function and the group clause ,
    it does not work unless i use only one column in the select statement ??
    thanks

    Pars
    And how exactly is this rewrite of the sql statement resolving the OP's issue.
    You are still using more than 1 column which will still result in the error message:
    Wrong number of columns selected in the SQL query.
    As mentioned in my earlier post APEX 4.0 (the version the OP is using) does not handle a sql statement with multiple columns for the dynamic action Set Value.
    Which means the fastest  and simplest solution is splitting up the dynamic action in multiple Set Value actions.
    Using this plugin or upgrade to a newer apex version would also be a possibility.
    Nicolette

  • How to dynamically create sql statement for Defaulting Segment Values?

    Hi,
    Navigation:
    1) Descriptive/Segments
    2) Query for DFF to be modified
    3) Uncheck “Freeze Flexfield Definition”
    4) (B) Segments
    5) Segments Summary form opens
    6) (B) open - Segments form opens
    Now, here I want to specify Default type as "SQL Statement" and in the default value field I want to use SQL statement with parameters (to evaluate the default value).
    The parameters should be pass at runtime from the form in which we have this DFF. The parameters value should be one of the values which get evaluated at runtime in the form window.
    Please suggest how we can achieve this?
    Or is there any alternative to achieve this?
    Thanks!!
    Regards,
    Narender
    Edited by: Narender Singh on Mar 30, 2010 7:47 AM
    Edited by: Narender Singh on Mar 30, 2010 7:48 AM

    Jason,
    it is possible, though not so simple as with a report.
    What you need to do is to create a pipelined function, that returns your date and count data. This pipelined function can be the base of a pseudo-table, which can be used in a select. For the pipelined function you need to define types for one row and a table to define the return-type for your function:
    create or replace type calendar_row as object (date_time date, description varchar2(250));
    create type calendar_table as table of calendar_row;
    Then you can create the package with the function:
    ================================================
    create or replace package dyn_calendar is
    procedure set_query(i_query in varchar2);
    function view_source return calendar_table pipelined;
    end;
    create or replace package body dyn_calendar is
    v_query varchar2(100) := null;
    procedure set_query(i_query in varchar2) is
    begin
    v_query := i_query;
    end;
    function view_source return calendar_table pipelined is
    TYPE cursor IS REF CURSOR;
    c_cal cursor;
    v_date_time date := null;
    v_description varchar2(100) := null;
    r_cal calendar_row;
    begin
    open c_cal for v_query;
    fetch c_cal into v_date_time, v_description;
    loop
    exit when c_cal%notfound;
    r_cal := calendar_row(v_date_time, v_description);
    pipe row(r_cal);
    fetch c_cal into v_date_time, v_description;
    end loop;
    return;
    end;
    end;
    ================================================
    Now you can set query in a PL/SL region before the calendar:
    dyn_calendar.set_query(SELECT count(*), ' || :P8_SOURCE_DATE || ' FROM ' || :P8_SOURCE_TABLE || ' GROUP BY ' || :P8_SOURCE_DATE);
    and you can base your calendar on the query:
    select * from table(dyn_calendar(view_source))
    Good luck,
    Dik

  • How to pass the bind variable value to the sql statement of the LOV

    Hi,
    I am using Forms 10g builder.
    I have a text item which will be populated by a LOV when i press a button, but i have a bind variable in the SQL statement of the LOV. That bind variable should be replaced by a value which is derived from a radio group in the same data block.
    For Ex: ( )radio1 ( )radio2
    before i click on the push button, I'll select one of the radio button above,so my question is how to assign this radio group value to the bind variable in the sql statement in the LOV?
    Pl any hint is appreciated!
    Thanks
    Reddy

    The variable can be taken into account in the SELECT order contained in the Record Group used by the LOV.
    e.g. Select ... From ... Where column = :block.radio_group ...Francois

  • SQL Statement ignored performing List of Values query

    Hi, New user just learning the basics. I have created a simple table PERSON with columns, ID, firstname, lastname, phone, city, State_ID
    Then clicked create Lookup table - State_Lookup with columns State_ID and State_Name.
    I create a page, include all columns from PERSON. For State the field is a select list that should do a lookup form the STATE_LOOKUP table. (I have entered 4 states in the table)
    I am getting the following error however:
    Error: ORA-06550: line 1, column 14: PL/SQL: ORA-00904: "STATE_ID": invalid identifier ORA-06550: line 1, column 7: PL/SQL: SQL Statement ignored performing List of Values query: "select STATE_ID d, STATE_ID v from STATE_ID_LOOKUP order by 1".
    I have not entered any sql, just selected all of my options using defaults and dropdowns. What is causing the error and what do I need to change?
    Thanks

    Okay, learned something: The database link name used, must not contain a dash. The DB_DOMAIN is appended automatically when you create a DB link, so if IT contains a dash, the db link name does as well. Check DBA_DB_LINKS to make sure you don't hit this well-hidden feature.
    Regards
    Martin Klier
    [http://www.usn-it.de|http://www.usn-it.de]

  • How to put the SQL-statement returned value into the field (as a default)

    Hi,
    I am using Developer/2000 (Forms Designer) under windows 98.
    Please tell me how to put the SQL-statement value (as a default value) into the field before enter-query mode. Noted that I have tried the following ways but still some problems:-
    1) Place the SQL-statement into PRE_QUERY trigger in the form/block level.
    There is a message box which ask 'Do you want to save the changes?'.
    2) Place the SQL-statement before execute enter_query. There is still a
    message box which ask 'Do you want to save the changes?'.
    Any hints? Thanks. Urgent.

    solved it!
    1) Suppress DEFAULT save message
    if form_failure then
    raise form_trigger_failure;
    end if;
    2) Place the default value before enter-query.
    Ref: Title='Default value in query field in ENTER_QUERY mode' in designer forum by CVZ
    form level trigger
    ============
    WHEN-NEW-ITEM-INSTANCE
    =======================
    if :system.mode = 'ENTER-QUERY' then
    :block.item := 'default waarde';
    end if;
    3) Suppress the changes whenever leaving the default field.
    if :block.item is null then
    -- assign statement
    end if;

  • Prepared SQL statement to test existence of a value in a row

    Excuse my ignorance in SQL. I didn't do much in SQL queries or DB design in general, but I'm eager to learn.
    Idea behind: I'm traversing a directory tree (Java, jdbc) (depth first) and want to collect all files
    in that tree and put the as BLOBS into the database.
    To find out whether a file is the same as another file (possibly in a different path) I calculate the md5sum
    (not sure whether it is proof against collisions or if I should use SHA-256 or some combination of md5sum + chksum).
    Anyway, let the md5sum be the unique value that makes the identity of a file for now.
    My problem: Find the jdbc/SQL statements that let me decide whether the file (md5sum) is already stored in a ROW
    upon which I can decide to either do the INSERT or mark the existing file as being present in a different path.
    I stumbled across the problem in the moment when I first time tried to INSERT a row and got told that
    md5sum gotta be unique.
    Any ideas for design and query? The code example below is incomplete. Especially what I'm looking for is
    how to construct a prepared SQL statement into which I can inject the variable later found (md5sum)
    Whether I should do that by COUNT(*) or a different method?
    Christoph
    Here is my sketchy code (Netbeans project) under construction:
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package testsqlite;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.security.MessageDigest;
    import java.security.NoSuchAlgorithmException;
    import java.sql.*;
    import java.util.Iterator;
    import java.util.List;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    * @author chris
    public class Main {
    * @param args the command line arguments
    private static Connection conn;
    private static String sql="INSERT INTO part(name,md5sum) VALUES (?,?)";
    private static PreparedStatement pstmnt,pstmnt_ifexists ;
    private static String sql_ifexists="SELECT COUNT(*) FROM part WHERE md5sum=?"; // ???
    public static void main(String[] args) throws Exception{
    // TODO code application logic here
    System.out.println("Testsuite-Collector\n");
    String path="c:/usr/local/www/data/testsuite/mandanten/chris/probanden";
    File f = new File(path);
    Class.forName ("org.sqlite.JDBC");
    conn =
    DriverManager.getConnection("jdbc:sqlite:c:/users/chris/testsuite/versionen");
    Statement stat = conn.createStatement();
    pstmnt = conn.prepareStatement(sql);
    pstmnt_ifexists = conn.prepareStatement(sql_ifexists);
    // process
    Traverse(f);
    // watch result
    ResultSet rs = stat.executeQuery("select * from part;");
    while (rs.next()) {
    System.out.print("name=" + rs.getString("name") + " ");
    System.out.println("md5sum= " + rs.getString("md5sum"));
    rs.close();
    conn.close();
    private static void Traverse(File f) throws IOException {
    File[] files = f.listFiles();
    for( File file : files) {
    if(file.isDirectory()){
    Traverse(file);
    else {
    try {
    if(file.length() > 0){
    FileInputStream fis = new FileInputStream( file );
    String md5 = org.apache.commons.codec.digest.DigestUtils.md5Hex( fis );
    System.out.println(file.length() +" " md5"->"+file.getPath());
    // check whether md5sum is already existing
    pstmnt_ifexists=?????
    pstmnt.setString(1, file.getPath());
    pstmnt.setString(2, md5);
    pstmnt.executeUpdate();
    catch (SQLException e) {
    System.out.println("SQL error:" e.getMessage()"\n");
    }

    And you seriously think that attempting to insert a record and catching the error of it failing is a good design!?!?I certainly do. I agree with Peter here. You can either test for the existence of the record and insert it if absent, or insert the record willy-nilly and catch the exception. The second option is (a) atomic even without transactions and (b) clearly twice as efficient. Same consideration applies to e.g.
    if (!map.containsKey(key))
      map.put(key, value);
    else
      ; // it was already thereas opposed to
    if (!map.put(key, value)
      ; // it was already thereand many other situations of this kind, e.g.
    try
      if (InetAddress.isReachable(ip))
        s = new Socket(ip, port);
      else
        ; // host not up
    catch (ConnectException exc)
      // the host wasn't up during connect
    }as opposed to
    try
      s = new Socket(ip, port);
    catch (ConnectException exc)
      // host not up
    }or
    try
      if (file.exists())
        in = new FileInputStream(file);
      else
        ; // it wasn't there
    catch (IOException exc)
      // it wasn't there, etc ...
    }as opposed to
    try
      in = new FileInputStream(file);
    catch (FileNotFoundException exc)
      // it wasn't there
    }Slight absence of timing window problems in the cases that detect via exceptions, and considerably simpler code. Phobias about how to use exception handling need to be overcome.
    I've also had it seriously argued to me that you shouldn't catch EOFExceptions, merely change the format of your file so you 'know' when one is coming up. Sorry to say that I think this sort of thing is complete rubbish. There is a need for an out of band EOF signal with all the readXXX() methods, and this is it.

Maybe you are looking for

  • Runtime error in 32-bit Windows 7

    When installing InDesign CS6 on a 32-bit Windows 7 PC, opening the file gives the following error message: Half a year ago or so I was told that this problem was acknowledged, but none of the updates has fixed it. The same holds true, but the way, fo

  • How to display attributes in smartview through MDX

    Hello Everyone, I am trying to execute a MDX query in SV where I want to see the man months by individual project. I also want to see projects by level 0 of an attribute dimension. I got the first part working where I see man months by level 0 projec

  • What is covered under AppleCare+ insurance?

    I purchased AppleCare+ with my iPhone 4S and in the contract it says ''AppleCare+ extends service coverage to 24 months from the purchase date of your original iPhone, each subject to a 49$ handling fee.''  My question is what is actually covered by

  • EP Webdynpro problem

    Hello, EP 6.0 SP10 sometimes when we run a create order transaction in the portal we get an error.  (see below) I would also like to add that sometimes the "continue" button is disabled. So it seems like the connection to R/3 is failing or that de Po

  • Configuring airport express to work with a secure router

    i have installed a new router on our network and have added security.  My airport express no longer can recognize the network since I believe it has to pass along a password. How do I tell the airport express the network password?  Airport utility ve