Non Numeric Data query

Hi,
I'm trying to check our HR phone number table for phone numbers which contain anything except numbers and spaces.
Using sample data:
WITH sampledata AS
     (SELECT '01234 123456' col FROM DUAL UNION ALL
      SELECT '01234 123456 (Ext 456)' FROM DUAL UNION ALL
      SELECT '01234 123213234 (** 2342)' FROM DUAL)
SELECT *
  FROM sampledata;I'd like to use SQL to find the 2nd and 3rd examples (and any other rows where the telno does NOT contain just numbers and spaces).
I've tried:
adding a WHERE:
WHERE NOT REGEXP_INSTR(col,'[0-9]') > 0Or this:
where regexp_like(col, '[^[0-9]]*')But when I try that, all rows are returned, presumably because all rows contain numbers.
I'm not sure how to change to return lines which contain both numeric and alphanumeric data, but where spaces are ignored (i.e. if row1 in e.g. above is okay, rows 2 and 3 aren't).
Any advice much appreciated.
Thanks

20100511 wrote:
Or this:
where regexp_like(col, '[^[0-9]]*')But when I try that, all rows are returned, presumably because all rows contain numbers.You missed the space: where regexp_like(col, '[^[0-9] ]*')bye
TPD

Similar Messages

  • Compare non numeric data using arithmetic operations

    Hi
    Is there anyway to compare the non numeric data in a table to a numeric number.
    Want to run a query like
    SELECT rank_id
                                          FROM   mas_rank
                                          WHERE  rank_code > 26 Rank_code contains numeric as well as some non numeric data
    Thanx for the help

    Yes, it will work if you just say > '26' See this demo :
    SQL> create table mas_rank(rank_id number,rank_code varchar2(2));
    Table created.
    SQL> insert into mas_rank values (100,'aa');
    1 row created.
    SQL> insert into mas_rank values (101,'ab');
    1 row created.
    SQL> insert into mas_rank values (102,'ad');
    1 row created.
    SQL> insert into mas_rank values (103,'ag');
    1 row created.
    SQL> insert into mas_rank values (104,'ac');
    1 row created.
    SQL> insert into mas_rank values (105,'22');
    1 row created.
    SQL> insert into mas_rank values (106,'25');
    1 row created.
    SQL> insert into mas_rank values (107,'26');
    1 row created.
    SQL> insert into mas_rank values (108,'27');
    1 row created.
    SQL> insert into mas_rank values (109,'aa');
    1 row created.
    SQL> insert into mas_rank values (110,'28');
    1 row created.
    SQL> SELECT rank_id
      2                                        FROM   mas_rank
      3                                        WHERE  rank_code not in ('ab','ad','ag')
      4                                                 and rank_code > 26;
                                                   and rank_code > 26
    ERROR at line 4:
    ORA-01722: invalid number
    SQL> ed
    Wrote file afiedt.buf
      1  SELECT rank_id
      2                                        FROM   mas_rank
      3                                        WHERE  rank_code not in ('ab','ad','ag')
      4*                                                and rank_code > '26'
    SQL> /
       RANK_ID
           100
           104
           108
           109
           110
    SQL>Regards
    Girish Sharma

  • Is it possible to upload non-numeric data into Planning from ODI?

    Dear All,
    I have problem to upload non-numeric data into planning?
    Regards,
    Thomas

    I am not sure what that has to do with non-numeric data and planning.
    If you want to move your ODI environment then have a look at this post :- Re: move full ODI environment to another Machine...
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • How do I import non-numeric data into DIAdem?

    I have some non-numeric data in an Excel file which I would like to import into DIAdem. DIAdem recognizes the file and imports some of the data, but it only imports those cells that are purely numeric. Cells containing non-numeric characters are ignored. But I need that non-numeric data! How do I force DIAdem to import everything? (Some controls appear in the import dialog that seem like they might be useful here but they're greyed out.)

    Hi There,
    You can not load text columns from ASCII files into DIAdem 8.1 DATA channels (numbers only). But the ASCII Import Wizard will let you send those text values to either a separate ASCII file, which DIAdem can use to put them on a graph as labels, or to a DIAdem string array, which DIAdem can use to display them at various places in its environment.
    The below attachments demonstrate reading an ASCII text column into a DIAdem string array and displaying the values on a DIAdem table in GRAPH. Note that the index values of the string array are placed in a DIAdem DATA channel.
    Ask if you have further questions,
    Brad Turpin
    NI
    Attachments:
    ASCII_Text_Column.txt ‏1 KB
    ASCII_Text_Column.STP ‏1 KB
    ASCII_Text_Column.LPD ‏3 KB

  • Testing for non-Numeric Data in a varchar2

    Hello -
    What is the easiest way to test see if there is non-numeric data in a varchar2 column? The column holds ssn values, but I am unable to convert these values to numeric data, because somewhere the column is storing non-numeric data.
    Thanks in advance.

    Maybe something like this ?
    SQL> create or replace function test_num (var1 in varchar2) return varchar2
      2  is
      3     num     number;
      4  begin
      5     num := to_number (var1);
      6     return ('Number');
      7  exception
      8     when others then
      9             return ('Character');
    10* end;
    SQL> /
    Function created.
    SQL> select test_num ('111') from dual;
    TEST_NUM('111')
    Number
    SQL> select test_num ('aaa') from dual;
    TEST_NUM('AAA')
    Character
    SQL>                                                             

  • Non Numeric data

    Hi,
    Why Essbase database can store only "numeric" data is there any workaround to store "non-numeric" data in Essbase

    To expand on this, an analytical view of such data is questionable. While you could aggregate/consolidate and even analyze non-numeric (i.e. categorical responses), the business needs of such analysis are almost always better served with more appropriate tools.
    Compare this with regions, time, accounts -- where the structure of the database has an inherent consolidation or mathematical relationship. Deriving value from these numeric relationships is where multidimension analysis thrives.
    With text information, you would need to create artificial relationships for the different "values" that at best represent weighted values, not completely useless but again, the right tool would do you better. It seems to me like another case of using a hammer to pound a screw in because the screw driver is still in the tool box.
    Some over-eager (read: young) essbase developers love to throw the database logs into essbase cubes, too -- which is rather silly to me (if they don't have enough to keep them busy answering the user's needs, perhaps they should look for additional users...). The two issues have one thing in common: allowing the technology to dictate effort, rather than responding to a business need with targeted solutions.
    Hmmm, maybe I'll create a cube to store the number of added members by dimension and the database statistics across time so I can prove to my boss that I'm wasting enough time on boondoggles every day. Well, at least THAT data is numeric...
    The above was all said tongue in cheek -- you can use oddball things like this to answer some interesting questions. I just think that if you have questions like that, you should go talk to the CFO and finance departments a bit more to see what kind of questions you COULD be answering.

  • Numeric and Non Numeric Data

    Hi,
    I have to check the data in Varchar2 field idtr and if it is numeric some actions are to be done on the data and if it is numeric some other different action is to be done.
    So I used some logic for finding whether the data is numeric or non numeric which I got it from the net.
    Now my problem is all decimal numbers are to be treated as numeric but this logic is treating decimals as non numeric and I am not able to proceed further.
    Can some one help me out in this issue.
    Below is the Logic and actions I am doing
    select      pol_id,lpad(substr(trunc(to_number(idtr),0),1,10),10,0),idtr
    from           pl_insrd
    where      length(idtr) - length(translate(idtr,chr(1)||translate(idtr,CHR(1)||'1234567890',CHR(1) ),CHR(1) ) ) = 0
    and           length(idtr) > 9
    UNION
    select      pol_id,lpad(trunc(idtr,0),10,0),idtr
    from           pl_insrd
    where      length(idtr) - length(translate(idtr,chr(1)||translate(idtr,CHR(1)||'1234567890',CHR(1) ),CHR(1) ) ) = 0
    and           length(idtr) < 10
    UNION
    select      pol_id,substr(idtr,1,10),idtr
    from           pl_insrd
    where      length(idtr) - Length(TRANSLATE(idtr,CHR(1)||TRANSLATE(idtr,CHR(1)||'1234567890', CHR(1) ), CHR(1) ) ) > 0
    and           length(idtr) > 9
    UNION
    select      pol_id,lpad(idtr,10,0),idtr
    from      pl_insrd
    where      length(idtr) - Length(TRANSLATE(idtr,CHR(1)||TRANSLATE(idtr,CHR(1)||'1234567890', CHR(1) ), CHR(1) ) ) > 0
    and           length(idtr) < 10

    <quote>One I provided was I found at asktom.oracle.com</quote>
    So? ... If you'd provided a link then one could see the entire context for that particular snippet of code and decide if it is indeed appropriate. As shown by Angus it is not always appropriate ... add to that, NULL is not a number as that function reports.
    <quote>It's using replace and transalate functions which are less expensive then To_Number function.</quote>
    Proof?
    <quote>I agree with you [John], that's the best function you can use to validate data for numeric.<quote>
    I don't agree to_number() is [always] the best way ... the easiest way? ... maybe.
    My personal view is that there is no universal way to determine if a string, in all circumstances, can be translated into a number. One has to have knowledge of the source data domain ... only you know if, in your particular circumstance, '1e4' is or is not a NUMBER represented as a string.
    flip@FLOP> select to_number('1e3') from dual;
    TO_NUMBER('1E3')
    1000

  • Report totals for non-numerical data

    Hello all,
    I am trying to update a site for an auto shop.  The site is in PHP, MySQL.
    What they have in the database is records for each customer that comes in to their shop.  So, they will have John Q. Public having multiple entries for the date he came in, and what was done to the car.  They want a report that will display the totals for each item that John Public has had done.
    So for example the report would be displaying the following:
                         breaks             oil change            shocks              tune up     total visits
    John Public       2                       4                        0                       2               8
    Jack Private       1                       6                       4                        8              19
    The database has this information in it to get the above report:
    Name             Date             Work          Cust. Review
    John Public    02-05-2007    breaks        satisfied
    John Public    03-15-2008    breaks        satisfied
    John Public    01-09-2008    oil change   satisfied
    Is there a way to do this?

    Well, I have done a lot of playing around, and got it to work.  Although, I don't completely understand why it works.  If someone would be kind enough to give me some insight, I would greatly appreciate it.  I have not done JOINS in the past, so I'm trying to learn.
    This is what I had originally:
    <?php
    //Query the unique works to generate the headers
    $query = "SELECT DISTINCT reason FROM `call_log` ORDER BY reason";
    $result = mysql_query($query) or die(mysql_error());
    while($record = mysql_fetch_assoc($result))
    $reasons[] = $record['reason'];
    //Start the report table including headers
    $report = "<table width=\"75%\" cellpadding=\"5\" cellspacing=\"5\" border=\"1\">\n";
    $report .= "  <tr><th>Store</th><th>" . implode('</th><th>', $reasons) . "</th></tr>\n";
    //Query the records
    $query = "SELECT t2.location, t2.reason, COUNT(t1.reason) as total
              FROM (
                  SELECT tt1.location, tt2.reason
                  FROM (SELECT DISTINCT location FROM `call_log`) tt1,
                       (SELECT DISTINCT reason FROM `call_log`) tt2) t2
              LEFT JOIN `call_log` t1
              ON t1.location = t2.location AND t1.reason = t2.reason
              GROUP BY t2.reason, t2.location
              ORDER BY t2.location, t2.reason";
    $result = mysql_query($query) or die(mysql_error());
    And this is what I changed it to:
    <?php
    //Query the unique works to generate the headers
    $query = "SELECT DISTINCT call_log.reason, call_reason.reason_id, call_reason.reason
       FROM call_log LEFT JOIN call_reason
       ON call_log.reason = call_reason.reason_id
       ORDER BY call_log.reason";
    $result = mysql_query($query) or die(mysql_error());
    while($record = mysql_fetch_assoc($result))
    $reasons[] = $record['reason'];
    // Query to get the top headers to have the correct column span
    $query = "SELECT COUNT(*) AS reason_id FROM call_reason";
    // Execute Query for the correct column span
    $result = mysql_query($query);
    // Get the result of query named count
    $count = mysql_result($result,0);
    //Start the report table including subheaders for the reason totals
    $report = "<table width=\"75%\" cellpadding=\"5\" cellspacing=\"5\" border=\"1\">\n";
    $report .= "  <tr><th style=\"border-color:#000;\">Store</th><th colspan=\"$count\" style=\"border-color:#000;\">Reasons for the Call</th></tr>\n";
    $report .= "  <tr><th></th><th>" . implode('</th><th>', $reasons) . "</th></tr>\n";
    //Query the records
    $query = "SELECT t2.location, t2.reason, COUNT(t1.reason) as total
              FROM (
                  SELECT tt1.location, tt2.reason
                  FROM (SELECT DISTINCT location FROM `call_log`) tt1,
                       (SELECT DISTINCT reason FROM `call_log`) tt2) t2
              LEFT JOIN `call_log` t1
              ON t1.location = t2.location AND t1.reason = t2.reason
              GROUP BY t2.reason, t2.location
              ORDER BY t2.location, t2.reason";
    $result = mysql_query($query) or die(mysql_error());
    It's the first section of:
    $query = "SELECT DISTINCT call_log.reason, call_reason.reason_id, call_reason.reason
       FROM call_log LEFT JOIN call_reason
       ON call_log.reason = call_reason.reason_id
       ORDER BY call_log.reason";
    $result = mysql_query($query) or die(mysql_error());
    while($record = mysql_fetch_assoc($result))
    $reasons[] = $record['reason'];
    that I'm wodering about.  Since I didn't realize that I defined the vairable for call_reason.reason how did it know to display the data from that field?  I know I joined the tables, but why would it not display the call_reason.reason_id?
    Thank you very much.

  • Data Storage in Essbase -- Non Numeric

    Hi Experts,
    Could you please guide me how the non numeric data is stored in Essbase (which is not metadata). Ex: Dates, Text Etc...
    It it Essbase first convert date format into numeric and then store or something else???
    Thanks
    N Kumar

    From version 11, Essbase provides some support for text and date measures natively.
    Text measures allow a predefined set of text values to be mapped to a predefined set of numeric values - there is no native support for loading 'free text'. The text measure 'mappings' are stored in the Essbase outline (.otl), but for both text and date cases the value itself is stored numerically, like any other data cell.
    You can also use formats to convert numeric values to text when reporting. Again, Essbase 'really' only stores data as numbers.
    Check out the following page from the latest Database Administrators Guide, which covers all these topics: http://download.oracle.com/docs/cd/E17236_01/epm.1112/esb_dbag/frameset.htm?dtypmeas.html
    Edited by: TimG on Jul 8, 2010 5:30 AM
    John got there before me. Still, follow the link to the DBAG!

  • Using MODEL clause and COUNT for not numeric data columns....

    Hi ,
    Is it possible somehow to use the COUNT function to transform a non-numeric data column to a numeric data value (a counter) and be used in a MODEL clause....????
    For example , i tried the following in the emp table of SCOTT dataschema with no desired result...
    SQL> select deptno , empno , hiredate from emp;
    DEPTNO EMPNO HIREDATE
        20  7369 18/12/1980
        30  7499 20/02/1981
        30  7521 22/02/1981
        20  7566 02/04/1981
        30  7654 28/09/1981
        30  7698 01/05/1981
        10  7782 09/06/1981
        20  7788 18/04/1987
        10  7839 17/11/1981
        30  7844 08/09/1981
        20  7876 21/05/1987
        30  7900 03/12/1981
        20  7902 03/12/1981
        10  7934 23/01/1982
    14 rows selected Now , i want to use the MODEL clause in order to 'predict' the number of employees who were going to be hired in the 1990 per deptno...
    So , i have constructed the following query which , as expected, does not return the desired results....
    SQL>   select deptno , month , year , count_
      2    from
      3    (
      4    select deptno , to_number(to_char(hiredate,'mm')) month ,
      5                to_number(to_char(hiredate , 'rrrr')) year , count(ename) count_
      6    from emp
      7    group by  deptno , to_number(to_char(hiredate,'mm'))  ,
      8                to_number(to_char(hiredate , 'rrrr'))
      9    )
    10    model
    11    partition by(deptno)
    12    dimension by (month , year)
    13    measures (count_ )
    14    (
    15     count_[1,1990]=count_[1,1982]+count_[11,1982]
    16    )
    17  /
        DEPTNO      MONTH       YEAR     COUNT_
            30          5       1981          1
            30         12       1981          1
            30          2       1981          2
            30          9       1981          2
            30          1       1990
            20          4       1987          1
            20          5       1987          1
            20          4       1981          1
            20         12       1981          1
            20         12       1980          1
            20          1       1990
            10          6       1981          1
            10         11       1981          1
            10          1       1982          1
            10          1       1990 As you see , the measures for the 1990 year is null...because the measure(the count(deptno)) is computed via the group by and not by the MODEL clause...
    How should i transform the above query... so as the "count_[1,1982]+count_[11,1982]" will return non-null results per deptno...????
    Thanks , a lot
    Simon

    Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
    Connected as hr
    SQL>
    SQL> SELECT department_id, MONTH, YEAR, count_
      2    FROM (SELECT e.department_id
      3                ,to_number(to_char(e.hire_date, 'mm')) MONTH
      4                ,to_number(to_char(e.hire_date, 'rrrr')) YEAR
      5                ,COUNT(e.first_name) count_
      6            FROM employees e
      7            WHERE e.department_id = 20
      8           GROUP BY e.department_id
      9                   ,to_number(to_char(e.hire_date, 'mm'))
    10                   ,to_number(to_char(e.hire_date, 'rrrr')));
    DEPARTMENT_ID      MONTH       YEAR     COUNT_
               20          8       1997          1
               20          2       1996          1
    SQL> --
    SQL> SELECT department_id, MONTH, YEAR, count_
      2    FROM (SELECT e.department_id
      3                ,to_number(to_char(e.hire_date, 'mm')) MONTH
      4                ,to_number(to_char(e.hire_date, 'rrrr')) YEAR
      5                ,COUNT(e.first_name) count_
      6            FROM employees e
      7            WHERE e.department_id = 20
      8           GROUP BY e.department_id
      9                   ,to_number(to_char(e.hire_date, 'mm'))
    10                   ,to_number(to_char(e.hire_date, 'rrrr')))
    11  model
    12  PARTITION BY(department_id)
    13  dimension BY(MONTH, YEAR)
    14  measures(count_)(
    15    count_ [1, 1990] = count_ [2, 1996] + count_ [8, 1997]
    16  );
    DEPARTMENT_ID      MONTH       YEAR     COUNT_
               20          8       1997          1
               20          2       1996          1
               20          1       1990          2
    SQL> ---
    SQL> SELECT department_id, MONTH, YEAR, count_
      2    FROM (SELECT e.department_id
      3                ,to_number(to_char(e.hire_date, 'mm')) MONTH
      4                ,to_number(to_char(e.hire_date, 'rrrr')) YEAR
      5                ,COUNT(e.first_name) count_
      6            FROM employees e
      7           GROUP BY e.department_id
      8                   ,to_number(to_char(e.hire_date, 'mm'))
      9                   ,to_number(to_char(e.hire_date, 'rrrr')))
    10  model ignore nav
    11  PARTITION BY(department_id)
    12  dimension BY(MONTH, YEAR)
    13  measures(count_)(
    14    count_ [1, 1990] = count_ [2, 1996] + count_ [8, 1997]
    15  );
    DEPARTMENT_ID      MONTH       YEAR     COUNT_
              100          8       1994          2
               30         12       1997          1
              100          3       1998          1
               30          7       1997          1
                           5       1999          1
               30         12       1994          1
               30         11       1998          1
               30          5       1995          1
              100          9       1997          2
              100         12       1999          1
               30          8       1999          1
                           1       1990          0
               30          1       1990          0
              100          1       1990          0
               90          9       1989          1
               20          8       1997          1
               70          6       1994          1
    93 rows selected
    SQL>

  • Error while pulling data from an Oracle database. ORA-01858: a non-numeric character was found where a numeric was expected

    I'm trying to pull data from an Oracle database using SSIS. When I try to select a few fields from the source table, it returns the following error message:
        [OLE DB Source [47]] Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E14.
        An OLE DB record is available.  Source: "OraOLEDB"  Hresult: 0x80040E14  Description: "ORA-01858: a non-numeric character was found where a numeric was expected".
        An OLE DB record is available.  Source: "OraOLEDB"  Hresult: 0x80004005  Description: "ORA-01858: a non-numeric character was found where a numeric was expected".
    The source columns are a combination of numeric and texts, and I've also tried selecting one of them, which didn't work. I'm using the Oracle client 11.2.0.1, and it works fine with any other data sources I have connected to so far. How can I resolve this
    error?

    Hi H.James,
    According to your description, the issue is a non-numeric character was found where a numeric was expected while pulling data from an Oracle database in SSIS.
    Based on the error message, the issue should be you are comparing a number column to a non-number column in a query. Such as the query below (ConfID is a number, Sdate is a date):
     where C.ConfID in (select C.Sdate
                       from Conference_C C
                       where C.Sdate < '1-July-12')
    Besides, a default behavior for the Oracle OleDb Provider that change the NLS Date Format of the session to 'YYYY-MM-DD HH24:MI:SS can also cause the issue. For more details about this issue, please refer to the following blog:
    http://blogs.msdn.com/b/dataaccesstechnologies/archive/2012/01/20/every-bug-is-a-microsoft-bug-until-proven-otherwise.aspx
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Trying to create non-numeric key figure in Query

    Hello, I am trying to add a formula into my BW Query that will return a non-numeric value.
    My cube will be used like a standard BW cube 90% of the time, but there is one query request that wants to display atomic data and have non-numeric categories determine at time of query run.
    Example:
    Field A has integer values
    Key           Value
    Record 1     -1
    Record 2      2
    Record 3      6
    I want to add a calculated field with the following logic:
    If Value is <= -1 then display "Early" else if Value is >-1 and <=5 then display "On-Time" else if Value is > 5 then display "Late".  The -1 and 5 values will be replaced with variables that will be required on the selection screen.
    This would return a grid as below:
    Key           Value    Calculated Field
    Record 1     -1           "Early"
    Record 2      2           "On-Time"
    Record 3      6           "Late"
    I haven't been able to figure out how to set up this field.  Any ideas?

    Hi,
    check these help links
    http://help.sap.com/saphelp_nw04/helpdata/en/8f/da1640dc88e769e10000000a155106/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/95/1ae03b591a9c7ce10000000a11402f/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/80/1a6305e07211d2acb80000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/80/1a6312e07211d2acb80000e829fbfe/content.htm
    It's a big topic so it's not possible to write everything here.
    You can search the forums also.
    Thanks

  • PL/SQL Function Returning Query Error / ORA-01858: a non-numeric char.....

    I'm trying to write a PL/SQL function to dynamically return a query with varying # of columns. I've done this type of thing before wiith much success, however this is the first time I'm using a cursor for loop within a function to accomplish my task.
    here is the error I get:
    ORA-01858: a non-numeric character was found where a numeric was expected
    Error ERR-1101 Unable to process function body returning query.
    Mind you I have tested the PL/SQL from a SQL editor and it works fine. I'm confused.
    Code is below.
    Thanks in advance!
    DECLARE
    my_query varchar2(4000);
    string1 varchar2(50) := 'select city, ';
    string2 varchar2(4000) := '' ;
    string3 varchar2(4000):= 'from
    ( select a.title, a.city, a.start_date, sum(a.total_stu) cnt
    from sj_class_summary3 a
    group by a.title, a.city, a.start_date
    having a.title = :P4_COURSE )
    group by title, city';
    TYPE date_tab_type IS TABLE OF date INDEX BY PLS_INTEGER;
    date_tbl date_tab_type;
    i number;
    BEGIN
    i:=1;
    for myrec in (select distinct start_date from sj_class_summary3
    where start_date between :P4_START_DATE and :P4_END_DATE order by 1) loop
    date_tbl(i) := myrec.start_date;
    string2 := string2 || ' max( decode( start_date, ''' || date_tbl(i) || ''', cnt,0) ) "' || date_tbl(i) || '", ';
    i := i+ 1;
    end loop;
    string2 := SUBSTR(string2,1,LENGTH(string2)-2);
    string2 := string2 || ' ';
    my_query := string1 || string2 || string3;
    return my_query;
    END;

    Hi Bob,
    you also have another date to character to date conversion in:
    decode( start_date, ''' || date_tbl(i) || ''', cnt,0)
    does this need to be:
    decode( start_date, to_date(''' || to_char(date_tbl(i), 'dd/mm/yyyy') || ''', ''dd/mm/yyyy''), cnt,0)
    Regards
    Michael

  • Retrieving spatial and non spatial data in one query

    Hello. I am having slight difficulties using JDBC to retrieve both spatial and non spatial data in the same query. The following is code from a sample program of mine that retrives spatial data from spatial tables.
    (In spatialquery geom is a geometry column and city is simply the name of the city):
    try
    Geometry geom = null;
    String database = "jdbc:oracle:thin:@" + m_host + ":" + m_port + ":" + m_sid;
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    con = (OracleConnection)DriverManager.getConnection(database, sUsername, sPassword);
    GeometryAdapter sdoAdapter =
    OraSpatialManager.getGeometryAdapter("SDO", "8.1.7", STRUCT.class, null, null, con);
    String spatialquery = "SELECT a1.geom, a1.city \n" +
    "FROM cities a1";
    Statement stmt = con.createStatement();
    OracleResultSet rs = (OracleResultSet) stmt.executeQuery(spatialquery);
    int i = 0;
    int noOfFeatures = 2;
    while (rs.next())
    for(i = 1; i <= noOfFeatures; i++)
    STRUCT dbObject = (STRUCT)rs.getObject(i);
    try
    geom = sdoAdapter.importGeometry(dbObject);
    catch(GeometryInputTypeNotSupportedException e)
    System.out.println("Input Type not supported");
    catch(InvalidGeometryException e)
    System.out.println("Invalid geometry");
    System.out.println(geom);
    }//end while loop
    This retrieves the sptial data fine, however when I attempt to retreive the non-spatial data I keep getting a "ClassCastException" error. I understand it is something to do with "STRUCT dbObject = (STRUCT)rs.getObject(i);" line. Can anyone tell me how to retrieve both spatial and non-spatial data in the one query using JDBC. I have tried nearly everything at this stage. Cheers joe

    Theresa A Radke
    Posts: 20
    OTN Member Since: Jul, 2001
    retrieving spatial and non spatial in same query. May 23, 2003 12:02 AM
    retrieving spatial and non spatial in same query.

  • How do I take two separate non numeric fields in a acrobat form and combine the data to display in a third separate field?

    How do I take two separate non numeric fields in a acrobat form and combine the data to display in a third separate field?

    You have to use custom JavScripting to concatenate the first 2 fields. You cannot use the first 2 calculation options because they force the values of the fields to a numeric value or ignore string values.
    Possible scripts for the 3rd field are:
    event.value = this.getField("Text1").valueAsString + " " + this.getField("Text2").valueAsString;
    or
    event.value = this.getField("Text1").valueAsString.concat( " ",  this.getField("Text2").valueAsString);
    If you do not want change the separator or not show the separator when on or the other field is empty, you will need to add more code to adjust for change.
    The above scripts will also concatenate number because the field values are read as strings and not numbers.
    There is also a generalized user written function to concatenate up to 3 fields with a separator that adjust for missing data.

Maybe you are looking for

  • Avi frame by frame, it doesn't play

    Hi, i'm on Mac Os X 10.7.1, with QuickTime Player X 10.1 and Perian 1.2.3. When i start an avi file with the Quick Look it plays normally, but with QuickTime Player every time i play, it goes forward 1 frame than it stops. Any idea?

  • How many apple TVs can you have on one network 5, 10, 15, infinite?

    I have an application where there are many rooms and I would like to be able to use Airplay in each room, can I buy 10 or more Apple TV units and put them all over my house on my wireless network and be able to airplay to any one of them? What is the

  • "ORA-1722 Invalid number" error while runing a SQL script in SQL*Plus

    Hello, I created a SQL script that is intended to populate tables with baseline data. When I run the script in the SQL*Plus program that comes with the Oracle 8.1.6 (client), I receive an "ORA- 1722 Invalid number". The error always occurs when SQL*P

  • No 1920x1080 output to external monitor from MBP 2011 OSX 10.6.8

    Hi, I have a MBP 2011 running OSX 10.6.8. I have recently purchased an Asus ML249H Monitor and the Kanex Mini DisplayPort to HDMI Cable 10 ft (3 m) MDPHD10FT. The monitor should display at 1920x1080 natively but does not. The MBP max output resolutio

  • Canvas - Flickering

    Hi everyone! I'm using Canvas and i have problem with the flickering effect. I'm not sure if my problem is flickering because i'm brazilian and i don't know the exact meaning of 'flicker' but i think it's this. Well, i have read the other topics abou