Finding a char value from a column

Hi
I have a column which is of type varchar and it contains numeric data as well as characters
like '154564A15' or 'DA15454A' or '1454564651'
some rows only have numbers but some even have characters...i want to find all records which contains the characters ie '154564A15' or 'DA15454A' not the third one '1454564651'
The data base we are using is oracle 9i...i cannt use regular expressions...do we have any other way which can fetch this data

Tubby,
Its cut and paste from sqlplus window of 10.2.0.1 from windows xp machine:
SQL> ed
Wrote file afiedt.buf
  1    with data as
  2    (
  3       select 'DA15454A' as col1 from dual union all
  4       select '154564A15' as col1 from dual union all
  5       select '1454564651' as col1 from dual union all
  6       select '+45' as col1 from dual
  7    )
  8    select *
  9    from data
10    where
11    decode( replace(translate(col1,'+-1234567890.','0000000000000'),'0',''),
12                                              NULL, to_number(col1),
13*                                                0 ) > 0
SQL> /
COL1
1454564651
+45
SQL> ed
Wrote file afiedt.buf
  1    with data as
  2    (
  3       select 'DA15454A' as col1 from dual union all
  4       select '154564A15' as col1 from dual union all
  5       select '1454564651' as col1 from dual union all
  6       select '-45' as col1 from dual
  7    )
  8    select *
  9    from data
10    where
11    decode( replace(translate(col1,'+-1234567890.','0000000000000'),'0',''),
12                                              NULL, to_number(col1),
13*                                                0 ) > 0
SQL> /
COL1
1454564651Why it is not showing the negative values; even as Tom has suggested that just that "add a dash into the replace function and turn the dash into a zero." in the this thread:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2460648511591
I have read the whole page, but not able to understand how do i get negative numbers too.
I shall be thankful to you, if you please reply.
Regards
Girish Sharma

Similar Messages

  • How find out the duplicate value from each columns.

    I have below four columns,
    How can i find out the duplicate value from each columns.
    with All_files as (
    select '1000' as INVOICE,'2000' AS DELIVERYNOTE,'3000' CANDELINVOICE,'4000' CANDELIVERYNOTE from dual union all
    select '5000','6000','7000','8000' from dual union all
    select '9000','1000','1100','1200' from dual union all
    select '1200','3400','6700','8790' from dual union all
    select '1000','2000','3000','9000' from dual union all
    select '1230','2340','3450','4560' from dual
    SELECT * FROM All_files
    Output should be as per below.
    1000 2000 3000 4000
    9000 1000 1100 1200
    1200 3400 6700 8790
    1000 2000 3000 9000
    Required to check uniqueness in cross columns.
    Thanks.

    Try this (sorry about the formatting)...
    WITH all_files AS (SELECT   '1000' AS INVOICE,
                                '2000' AS DELIVERYNOTE,
                                '3000' CANDELINVOICE,
                                '4000' CANDELIVERYNOTE
                         FROM   DUAL
                       UNION ALL
                       SELECT   '5000',
                                '6000',
                                '7000',
                                '8000'
                         FROM   DUAL
                       UNION ALL
                       SELECT   '9000',
                                '1000',
                                '1100',
                                '1200'
                         FROM   DUAL
                       UNION ALL
                       SELECT   '1200',
                                '3400',
                                '6700',
                                '8790'
                         FROM   DUAL
                       UNION ALL
                       SELECT   '1000',
                                '2000',
                                '3000',
                                '9000'
                         FROM   DUAL
                       UNION ALL
                       SELECT   '1230',
                                '2340',
                                '3450',
                                '4560'
                         FROM   DUAL),
        t_base
           AS (SELECT      invoice
                        || ','
                        || deliverynote
                        || ','
                        || candelinvoice
                        || ','
                        || candeliverynote
                           str
                 FROM   all_files),
        t_str
           AS (SELECT   str || ',' AS str,
                        (LENGTH (str) - LENGTH (REPLACE (str, ','))) + 1
                           AS no_of_elements
                 FROM   t_base),
        t_n_rows
           AS (    SELECT   LEVEL AS i
                     FROM   DUAL
               CONNECT BY   LEVEL <=
                               (    SELECT   SUM (no_of_elements) FROM t_str)),
        t_build AS (SELECT   t_str.str,
                             nt.i AS element_no,
                             INSTR (t_str.str,
                                    DECODE (nt.i, 1, 0, 1),
                                    DECODE (nt.i, 1, 1, nt.i - 1))
                             + 1
                                AS start_pos,
                             INSTR (t_str.str,
                                    1,
                                    DECODE (nt.i, 1, 1, nt.i))
                                AS next_pos
                      FROM      t_str
                             JOIN
                                t_n_rows nt
                             ON nt.i <= t_str.no_of_elements),
        t_build2
           AS (SELECT   RTRIM (str, ',') AS original_string,
                        SUBSTR (str, start_pos, (next_pos - start_pos))
                           AS single_element,
                        element_no
                 FROM   t_build),
        t_build3
           AS (SELECT   single_element,
                        COUNT( * )
                           OVER (PARTITION BY single_element
                                 ORDER BY single_element)
                           ele_count
                 FROM   t_build2)
    SELECT   DISTINCT INVOICE,
                      DELIVERYNOTE,
                      CANDELINVOICE,
                      CANDELIVERYNOTE
      FROM   all_files, t_build3
    WHERE   ele_count > 1
             AND (   INVOICE = single_element
                  OR DELIVERYNOTE = single_element
                  OR CANDELINVOICE = single_element
                  OR CANDELIVERYNOTE = single_element)I think this will be faster than the previous solution?
    Cheers
    Ben
    Edited by: Munky on Feb 17, 2011 2:11 PM - "I think this will be faster than the previous solution?", nope - it's not :(

  • Get millisecond values from timestamp column in v$logmnr_contents

    Hello
    How do we get millisecond values from timestamp column in v$logmnr_contents.
    I tried with following query.
    select scn,To_Char(timestamp,'DD-MON-YYYY HH24:MI:SS:FF') from v$logmnr_contents WHERE OPERATION NOT IN('START') and username ='SCOTT' and sql_redo is not null and (seg_owner is null or seg_owner not in('SYS'));
    it says ORA-01821: date format not recognized. I want to find the relation of scn with timestamp. In forums i found, scn is derived from timestamp value. I dont know its correct or not.
    if i query with out FF in time format i get like
    scn timestamp
    808743 27-NOV-2007 00:12:53
    808743 27-NOV-2007 00:12:53
    808743 27-NOV-2007 00:12:53
    808744 27-NOV-2007 00:12:53
    808744 27-NOV-2007 00:12:53
    808744 27-NOV-2007 00:12:53
    if scn is derived from timestamp with milliseconds, each scn should be different right?More help please

    May be there's an easy way solving your problem, I did it like that:
    CREATE TABLE quota_test (test VARCHAR2(50))
    INSERT INTO quota_test
    VALUES ('update "SCOTT"."NEWTAB1" set a="34" and b="45"')
    SELECT test normal, REPLACE(SUBSTR(test,INSTR(test,'"',1),INSTR(test,'.',1)+2),'"','') changed
    FROM quota_test
    Result is :
    NORMAL
    update "SCOTT"."NEWTAB1" set a="34" and b="45"      
    CHANGED
    SCOTT.NEWTAB1
    If you didn't understand, I can explain what I wrote

  • Retrieving multiple values from one column in SELECT statement

    Hi,
    I have a slight dilemma in that I'm trying to pull down all the values from a column from a select statement that includes some JOINS in it.
    If I run the query at the SQL Plus prompt, it pulls back all the values/rows.
    When I run the select (and prepared ) statement in my JSP, it only pulls back one of the 4 values I'm trying to retrieve.
    e.g.
    at the DB level :
    SELECT role_name, CC_ID FROM votetbl a
    INNER JOIN APPROVERS b ON
    a.BUSVP = b.BUSVP AND
    a.BRANCH = b.BRANCH
    WHERE CC_ID = 1688this will return:
    ROLE_NAME CC_ID
    ops 1688
    ops 1688
    comply 1688
    legal 1688
    comply 1688
    When run in my JSP, like so:
    String primID3a = request.getParameter("primID");
    Statement stmtovoter = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
    String prepvotSQL = "SELECT role_name, CC_ID FROM votetbl a INNER JOIN APPROVERS b ON a.BUSVP = b.BUSVP AND " +
                         "a.BRANCH = b.BRANCH WHERE CC_ID = ?";
    PreparedStatement prepvotstmt = connection.prepareStatement(prepvotSQL);
    prepvotstmt.setString(1, primID3a);
    ResultSet rest3 = prepvotstmt.executeQuery();
    rest3.next();
    String votecat = rest3.getString(1);
    out.println("Vote category: "+votecat);I only get ops returned.
    Do I need to run an enumerator? Or reqest.getParameterValues or use a while statement around the results set?
    Any feedback and direction here is welcomed!
    Thanks!

    Actually, I tried looping and still only get 1, but returned several times.
    i.e.
    PreparedStatement prepvotstmt = connection.prepareStatement(prepvotSQL);
    prepvotstmt.setString(1, primID3a);
    ResultSet rest3 = prepvotstmt.executeQuery();
    rest3.next();
    String votecat = rest3.getString(1);
    while (rest3.next()) {
    out.print("category roles "+votecat);
    }then I get returned the following:
    admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admin
    like so.
    Where as at the DB level I get
    ROLE_NAME CC_ID
    admin 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    risk 1688
    comply 1688
    legal 1688
    legal 1688
    ops 1688
    comply 1688
    Maybe the while should go around the getString(1) designation? But I was thinking I'd tried that and gotten invalid cursor error
    Something is definitely amiss, between the prepared statement in the servlet and the SELECT statement at the DB level.
    I can totally hardcode the statement in the servlet or JSP and it will return one value potentially several times, but only one.
    Other times, it will not return a value at all, even though one resides in the db.
    Yet go to the DB/SQL Plus prompt and it returns perfectly. I can simply copy and paste the SELECT statement from the out.print line I made and it works like a champ in SQL Plus. Any ideas why the same exact thing cannot return the proper values within the servlet/JSP?
    Yeeeeeeesh!!! : (
    Message was edited by:
    bpropes20

  • From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    Hi,
    Use NVL or COALESCE:
    NVL (col_a, col_b)
    Returns col_a if col_a is not NULL; otherwise, it returns col_b.
    Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
    For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Getting char values from a string problem

    Hi,
    Here's an example of what I'm trying to do:
    boolean loopSwitch = true;
    while (loopSwitch)
         String orderDecider = JOptionPane.showInputDialog (null, "Would you like your numbers to be ordered in   ascending or descending order(A/D)",      "Order decision", JOptionPane.QUESTION_MESSAGE);
         if (orderDecider == A)
         loopSwitch = false;
         }I basically want the user to input either a/A/d/D and to get the char values from the string so I can use them in an if statement.
    Basically, I wanna parse the string into a char.
    Is this possible?
    Thanks.
    Edited by: xcd on Oct 16, 2009 8:38 AM

    Why not just use the String.equals() method to compare a String to a String?
    But if you must, you can use the String.charAt() method to return a char at a particular location in the String.
    Note: char literals need to be surrounded by single quotes ('A') and String literals need to be surrounded by double quotes ("A").

  • Reading values from lookup columns through custom workflow in SharePoint 2013

    We are able to read the values of text, number columns through custom workflow (via coding) in SharePoint 2013. However, we are not able to read values from lookup columns. So, request anyone to provide help on this.
    Thanks & regards,
    Aditya

    Hi,
    According to your post, my understanding is that you want to read values from lookup columns through custom workflow in SharePoint 2013.
    Since the workflow just doesn't get lookup fields, let's give it something static to work with instead. If we can capture the ID of the lookup field and store that as a static value in our list, the workflow can happily use that to look up our related.
    For more information, you can refer to:
    SharePoint 2013 Workflows and Lookup Columns
    Thanks,
    Linda Li                
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Linda Li
    TechNet Community Support

  • Finding the smallest value from an array

    Hi there :)
    I started learning Java a few days ago and have now run into my first problem :p
    I am using Netbeans on Mac OS X.
    I need to find the smallest value from an array. So far I've had no luck. Any suggestions would be fantastic.
    The code so far:
    * Math Problems
    * Created on May 4, 2007, 10:54 AM
    * PROJECT 1: - IN PROGRESS
    * Create a program that allows you to create an integer array of 18 elements with the following values
    * 3, 2, 4, 5, 6, 4, 5, 7, 3, 2, 3, 4, 7, 1, 2, 0, 0, 0
    *  - The program computes the sum of elements 0 to 14 and stores it in element 15                              // COMPLETED
    *  - The program computes the average and stores it in element 16                                              // COMPLETED
    *  - The program finds the smallest value from the array and stores it in element 17
    * PROJECT 2: - TO DO
    * Write a program that accepts from the command line and prints them out. Then use a for loop to print
    * the next 13 numbers in the sequence where each number is the sum of the previous two. FOR EXAMPLE:
    *  - input>java prob2 1 3
    *  - output>1 3 4 7 11 18 29 47 76 123 322 521 843 1364
    * PROJECT 3: - TO DO
    * Write a program that accepts from the command line two numbers in the range from 1 to 40. It then
    * compares these numbers against a single dimension array of five integer elements ranging in value
    * from 1 to 40. The program displays the message BINGO if the two inputted values are found in the array
    * element. FOR EXAMPLE:
    *  - input>java prob3 3 29
    *  - output>Your first number was 3
    *  -        Your second number was 29
    *  -        Its Bingo!  // This message if 3 and 29 are found in the array
    *  -        Bokya!      // This message if 3 and 29 are not found in the array
    *  -        The array was 7 5 25 5 19 30
    * PROJECT 3 EXTENSION: - OPTIONAL
    * Generate the array of 5 unique integers using random numbers
    package mathproblems;
    * @author Mohammad Ali
    public class Main {
        /** Creates a new instance of Main */
        public Main() {
         * @param args the command line arguments
        public static void main(String[] args) {
            int A[]={3,2,4,5,6,4,5,7,3,2,3,4,7,1,2,0,0,0};
            int O = A.length - 3;
            int B = A[0] + A[1] + A[2] + A[3] + A[4] + A[5] + A[6] + A[7] + A[8] + A[9] + A[10] + A[11] + A[12] + A[13] + A[14];
            A[15] = B;  // Stores the sum of the integers in A[15]
            int C = B / O;
            A[16] = C;  // Computes and stores the average in A[16]
            int D = 101;
                if (A[0] < A[1]) { D = A[0]; }
                else { D = A[1]; }
                if (A[1] < A[2]) { D = A[1]; }
                else { D = A[2]; }
            System.out.println("There are " + O + " numbers in the Array");
            System.out.println("Those numbers add up to " + B + ".");
            System.out.println("The average of those numbers is " + C + ".");
            System.out.println("The smallest value in the array is " + D + ".");
    }The code is incomplete, but it works so far. The problem is I know there must be an easier way. SAVE ME :)

    OK :)
    Just thought I should show you the output as to help anyone else with the same problem:
    * Math Problems
    * Created on May 4, 2007, 10:54 AM
    * PROJECT 1: - IN PROGRESS
    * Create a program that allows you to create an integer array of 18 elements with the following values
    * 3, 2, 4, 5, 6, 4, 5, 7, 3, 2, 3, 4, 7, 1, 2, 0, 0, 0
    *  - The program computes the sum of elements 0 to 14 and stores it in element 15                              // COMPLETED
    *  - The program computes the average and stores it in element 16                                              // COMPLETED
    *  - The program finds the smallest value from the array and stores it in element 17                           // COMPLETED
    * PROJECT 2: - TO DO
    * Write a program that accepts from the command line and prints them out. Then use a for loop to print
    * the next 13 numbers in the sequence where each number is the sum of the previous two. FOR EXAMPLE:
    *  - input>java prob2 1 3
    *  - output>1 3 4 7 11 18 29 47 76 123 322 521 843 1364
    * PROJECT 3: - TO DO
    * Write a program that accepts from the command line two numbers in the range from 1 to 40. It then
    * compares these numbers against a single dimension array of five integer elements ranging in value
    * from 1 to 40. The program displays the message BINGO if the two inputted values are found in the array
    * element. FOR EXAMPLE:
    *  - input>java prob3 3 29
    *  - output>Your first number was 3
    *  -        Your second number was 29
    *  -        Its Bingo!  // This message if 3 and 29 are found in the array
    *  -        Bokya!      // This message if 3 and 29 are not found in the array
    *  -        The array was 7 5 25 5 19 30
    * PROJECT 3 EXTENSION: - OPTIONAL
    * Generate the array of 5 unique integers using random numbers
    package mathproblems;
    * @author Mohammad Ali
    import java.util.Arrays;
    public class Main { 
        /** Creates a new instance of Main */
        public Main() {
         * @param args the command line arguments
         public static void main(String[] args) {
                  int A[]={3,2,4,5,6,4,5,7,3,2,3,4,7,1,2,0,0,0};
              Arrays.sort(A);
              System.out.println("The smallest value in the array is " + A[0] + ".");
              int num = A.length;
              System.out.println("There are " + num + " values in the Array.");
              int sum = 0;
              for (int i = 0; i < A.length; i++) {
                   sum+=A;
              System.out.println("Those numbers add up to " + sum + ".");
              double d = (double)sum/num;
              System.out.println("The average value of those numbers is " + d + ".");
    What Iearned:
    1) How to create for loops properly
    2) How to import java.util.Arrays ( =D )
    3) How to get a more accurate average using double instead of int
    4) This forum is the best and has very helpful people 24/7 ( =D)
    Thanks Again,
    Mo.

  • Find duplication values from multiple columns in a big table

    Hi All,
    I am working on a 11gR2 database in linux. i want to display record that have duplicate values in 2 columns.
    1. Table Structure :-
    CREATE TABLE A
    ID NUMBER(10),
    F_NAME VARCHAR2(100 BYTE),
    L_NAME VARCHAR2(100 BYTE)
    2. Sample Data:-
    Insert into A
    (ID, F_NAME, L_NAME) Values (1,'TONY' ,'SUMIT');
    Insert into A
    (ID, F_NAME, L_NAME) Values (2,'SUMIT' ,'KEITH');
    Insert into A
    (ID, F_NAME, L_NAME) Values (3,'NORA','SMITH');
    Insert into A
    (ID, F_NAME, L_NAME) Values (4,'APRIL','TONY');
    Insert into A
    (ID, F_NAME, L_NAME) Values (5,'ROSS','TAM');
    ID F_NAME L_NAME
    1 TONY SUMIT
    2 SUMIT KEITH
    3 NORA SMITH
    4 APRIL TONY
    5 ROSS TAM
    4. My requirement is i need display IDs that it's F_NAME or L_NAME has duplication in F_NAME or L_NAME columns.
    The result should be
    ID
    1 reason: F_NAME (TONY) equals to L_NAME of record 4, L_NAME (SUMIT) equals to F_NAME of record 2
    2 reason: F_NAME (SUMIT) equals to L_NAME of record 1
    4 reason: L_NAME (TONY) equals to F_NAME of record 1
    record 3, 5 aren't in the result because there is no duplication in F_NAME or L_NAME columns for NORA,SMITH, ROSS, TAM
    The table contains 10 million records, i really need to consider the performance.
    kindly suggest me the solution

    Note: Forum members please suggest better approach to this -- below.. convert into SQL :)
    I know I will be opposed by many people in this forum for posting such in-efficient solution.
    But trying to learn along with you.. its an interesting problem which must deal with all rows vs all rows to get all combinations.
    But I am still thinking how to write it in SQL, probably will learn from this post after we receive some good SQL solution for the code what I am currently doing now.
    step 1: created a table B similar to table A and added a column reason
    CREATE TABLE B
      ID      NUMBER(10),
      F_NAME  VARCHAR2(100 BYTE),
      L_NAME  VARCHAR2(100 BYTE),
      REASON  VARCHAR2(1000 BYTE)  --- ADDED THIS
    )Definetely inefficient :(
    BEGIN
       FOR rec_outer IN (SELECT * FROM A) LOOP
          FOR rec_inner IN (SELECT * FROM A) LOOP
             IF (rec_outer.f_name = rec_inner.l_name) THEN
                UPDATE B
                   SET reason =
                             rec_outer.id
                          || ' reason: F_NAME ('
                          || rec_outer.f_name
                          || ') equals to L_NAME of record '
                          || rec_inner.id
                 WHERE b.id = rec_outer.id;
             END IF;
          END LOOP;
          FOR rec_inner IN (SELECT * FROM A) LOOP
             IF (rec_outer.l_name = rec_inner.f_name) THEN
                UPDATE B
                   SET reason =
                          reason
                          || CASE
                                WHEN reason IS NULL THEN
                                   rec_outer.id || ' reason: '
                                ELSE
                             END
                          || 'L_NAME ('
                          || rec_inner.f_name
                          || ') equals to F_NAME of record '
                          || rec_inner.id
                 WHERE b.id = rec_outer.id;
             END IF;
          END LOOP;
       END LOOP;
       COMMIT;
    EXCEPTION
       WHEN OTHERS THEN
          rollback;
          RAISE;
    END;OUTPUT:
    ID     F_NAME     L_NAME     REASON
    1     TONY     SUMIT     1 reason: F_NAME (TONY) equals to L_NAME of record 4,L_NAME (SUMIT) equals to F_NAME of record 2
    2     SUMIT     KEITH     2 reason: F_NAME (SUMIT) equals to L_NAME of record 1
    3     NORA     SMITH     
    4     APRIL     TONY     4 reason: L_NAME (TONY) equals to F_NAME of record 1
    5     ROSS     TAM     Cheers,
    Manik.
    Edited : Added rollback

  • Direction Needed: Storing calculated values from datagrid column in order to call values into graph

    Hi all,
    I am new to Flex/Flash Builder, actionscript, and mxml, so please be kind.
    I have developed a small program that has a component that displays a datagrid fed with information out of a mysql db via a php data services connection. Within that same component (page), I have a graph that charts the dates via a plot chart. I am interested in adding a line series to the graph, but the data I want to use is a calculated field in the datagrid which I used a custom lable function to derive and display. Can someone steer me to the correct method to store such values and how to call them into a chart?
    Some addition information
    Custom label function:
      /* Custom label function for the Delta1 column. Calculates the number of days between the planting date and 10% flower. */
                                  private function calculateTo1stFlower(item:Object, column:GridColumn):String {
                                            var tempDate1:Date = new Date(item.dflower10 - item.dplanting);
                                            return Math.round((tempDate1.time / MS_PER_DAY) + 1).toString();
    /* Number of milliseconds in a day. (1000 milliseconds per second * 60 seconds per minute * 60 minutes per hour * 24 hours per day) */
                                  private const MS_PER_DAY:uint = 1000 * 60 * 60 * 24;
    Within my spark datagrid
    <s:GridColumn width="30" headerText="Δ1" labelFunction="calculateTo1stFlower" ></s:GridColumn>
    I assume I need to store the array of values for this column and then chart the saved values as the xField within the LineSeries. Should I use a class based model?
    The following link seemed like it may be an appropriate path; I am not sure though.
    http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7b51.html
    Thanks in advance for any support,
    Matthew

    Thanks for trying to post DDL, but you have no idea how to do a data model. You do not know that tables have to have keys, what ISO-11179 is, etc. 
    You have a table that is supposed to model companies. Your singular names says that there is only one company!  There is no company identifier (the industry standard is the DUNS). A customer is not a company. We do not use numeric data types for identifiers;
    do you do math on them? NO!  The attribute property comes after the attribute name (you never heard of ISO-11179). 
    Think about how silly VARCHAR(1) is. 
    CREATE TABLE Companies 
    (company_duns CHAR(9) NOT NULL PRIMARY KEY, 
     company_name VARCHAR(30)NOIT NULL, 
     margin_oil INTEGER NOT NULL, 
     margin_hangar INTEGER NOT NULL, 
     margin_cleaning INTEGER NOT NULL);
    INSERT INTO Companies
     VALUES (1, 'AviatKorea', 100, 125, 200), 
    (2, 'AXHollande', 50, 40, 30), 
    (3, 'BFXNorway', 60, 80, 600), 
    (4, 'EEEFrance', 10, 25, 60);
    CREATE TABLE Company_Tariffs
    (company_duns INTEGER NOT NULL
       REFERENCES Companies(company_duns), 
     tariff_type CHAR(1) NOT NULL
        CHECK (tariff_type IN ('A','B','C','D'),
     PRIMARY KEY (company_duns, tariff_type));
    INSERT INTO Company_Tariffs values (1, 'A'), (2, 'C'), (2, 'D'), (3, 'A'), (4, 'A'), (4, 'C'), (4, 'D')
    SELECT * -- do not use * in production code
      FROM Companies AS C,
           Company_Tariffs AS T 
     WHERE C.company_duns = T.company_duns;
    >> I would like something like with a computed column [ ] that retrieves the different contracts used: <<
    You might but a SQL programmer would not. This violated First Normal Form. It is a display report and is done in the presentation layers. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • How do I return a value from a column based on info from neighboring columns?

    I have a table of data that looks similar to this:
    Weight
    Name
    School
    Division
    106
    Name1
    School1
    1
    106
    Name2
    School2
    2
    106
    Name3
    School3
    3
    106
    Name4
    School4
    4
    113
    Name5
    School5
    1
    113
    Name6
    School6
    2
    113
    Name7
    School1
    3
    113
    Name8
    School3
    4
    It's a very large table, so there will be multiple matches for Schools, and occasionally a few matches for Names, but there will always be only one match for a given Weight and Division.
    In a separate table, how can I get the name of the person associated with the unique weight and division?
    In my head, the formula goes" "Look in the Weight column to find 106, then look in the Division column to find 4, then return the value from the Name column." But I can't figure out the formula that will do that.
    Any thoughts?

    Hi momogabi,
    This can be easily done with an index column.
    The formula I used in your original table for the index column is:
    =A2&"-"&D2. This was filled down. The column can be hidden.
    You can see the formula in the search table. If I wanted to eliminate the index column in that table the formula would look something like:
    =INDEX('Table 1-1'::B,MATCH(A2&"-"&B2,'Table 1-1'::E,0),1)
    Hope this helps.
    quinn

  • Finding the same value in different columns

    Hello,
    I am trying to figure out how I would go about finding the same value in the same row but in different columns. For example, in the table sometimes the report name is the same as the description. I would like to find all of the rows where this is the case.
    Thanks
    Report name
    Description
    Date
    Time
    Report 1
    Report 1
    dddd
    tttt
    Report 2
    Billing Report
    dddd
    tttt
    Report 3
    Report 3
    dddd
    tttt

    Hi,
    Is this what you want?
    SELECT  *       -- or whatever columns you want
    FROM    table_x
    WHERE   report_name = description
    If not, post  a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Get value from table column

    Hi,
    I am new to OAF, I am trying to get the value from the table in order to make validation. I have the following PG:
    SearchResultsTableRN
    itemRow
    DetailsCell
    DetailsTableLayout
    ShortDescRow
    ShortDescCell
    ShortDesc
    LongDescRow
    LongDescCell
    LongDesc
    AttributesRow
    AttributesCell
    AttributesTableLayout
    Attributes1Row
    Attribute11Cell
    ect...
    Can anyone help me please in how to go into the table --> row --> column to retrieve the value from a specific column?
    If their is a document or example that can help I will appreciate it. Since I tried searching in devguide and didn't find any results.
    Note: I am extending the controller and reached till the following code:
    public void processFormRequest(OAPageContext oapageContext, OAWebBean webBean){
    super.processFormRequest(oapageContext, webBean);
    String event = oapageContext.getParameter("ShortDescRow");
    OATableBean advtable = (OATableBean)webBean.findChildRecursive("SearchResultsTableRN");
    OARowBean rowtbl = (OARowBean)advtable.findChildRecursive("DetailsCell");
    String message = "test:"+event+"|"+advtable+"|"+"|"+"|"+"|";
    throw new OAException(message, OAException.INFORMATION);
    Thanks and Regards
    Patrick

    Patrick,
    My first advice would be go through OAF guide and do tutorial examples, for such basic details.
    If ur talking about tablelayout region
    u can use pageContext.getParameter(<Item id of UIX bean whose value u want>);
    If you are talking about table
    You can Iterate through the VO based on primary key ...on which the table is based, and retrive the corresponding Vo attribute value.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • To find a field value from a table

    i want to get some field value from a data dictionary table.
    for eg Tragr from Mara. in Fields list it shows the field is in Mara table. but in content screen it does not showing the field at all. Actually of 220 fields of mara table only 99 fields are shown. how to view all the fields of a particular field. is there any setting is there.

    Hi Deva,
    When we execute any table by default SAP will display only few columns.(90 i guess) If we want to view all the columns of the table then do like this after executing the table i.e in ur table output.
    Menupath->Settings->User parameters->choose radiobotton
    Grid display Here u can see all the fields.
    If u don't want to see all the fields then do like this.
    Settings->listformat->Choosefields->Deselectall->Select what
    ever fields u want using the search button in bottom and press enter. It will display only selected fields.
    Some times we will come up with strange situations.
    EG: In the field list some field will be there. But if u select that field from that table in select query it will give u syntax error saying field xxx does't exist in table yyy. This field is nothing but text table field. If u want to select this field then u have to select it from the text table. U can find the text table exist for some table or not in
    Menupath->goto->text table. (In this case makt is text table for mara)
    Just check below code for ur reference.
    DATA: wa_mara TYPE  mara.
    SELECT SINGLE * INTO wa_mara FROM MARA .
    Here if u go to mara table u have field MAKTX But above select will not return the field maktx even we are refering wa_mara to data base table mara. We have to explicitly select it from MAKT.
    Hope this clarified all ur doubts.
    Thanks,
    Vinod.

  • Multiple values from same column in diffetent columns in same row??

    Hi all,
    I am wondering how you can display different values from the same column into different columns on same row. For example using a CASE statement I can:
    CASE WHEN CODE IN ('1', '3') THEN COUNT( ID) END as "Y"
    CASE WHEN CODE NOT IN ('1', 'M') THEN COUNT( ID) END as "N"
    Yes this will produce two columns needed but will also produce two separate records and null values for the empty's.
    Any ideas?
    Thanks

    It's not clear what you want.
    Can you post some examples as described in the FAQ: {message:id=9360002}
    As my first guess, I would think you're looking for something like...
    SQL> select * from emp;
         EMPNO ENAME      JOB              MGR HIREDATE                    SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-1980 00:00:00        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-1981 00:00:00       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-1981 00:00:00       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-1981 00:00:00       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-1981 00:00:00       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-1981 00:00:00       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-1981 00:00:00       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-1987 00:00:00       3000                    20
          7839 KING       PRESIDENT            17-NOV-1981 00:00:00       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-1981 00:00:00       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-1987 00:00:00       1100                    20
          7900 JAMES      CLERK           7698 03-DEC-1981 00:00:00        950                    30
          7902 FORD       ANALYST         7566 03-DEC-1981 00:00:00       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-1982 00:00:00       1300                    10
    14 rows selected.
    SQL> select count(case when deptno in (10,20) then deptno end) as deptno_10_20
      2        ,count(case when deptno > 20 then deptno end) as deptno_30plus
      3  from emp;
    DEPTNO_10_20 DEPTNO_30PLUS
               8             6

Maybe you are looking for

  • JRE 1.4.2 GUI corrupt in Windows XP Pro

    Hi, I am a long-time java user. I have Windows XP Pro and everything was working just fine for me. Several days ago I tried to boot my computer and was informed that windows was corrupt and could not start. I used the XP Pro installation CD to repair

  • In function module creation,table, view is better or structure is better  ?

    I am creating a new z function module. Under tables parameter, I need to create 'Profit_Center_Table'  which should contain combination of ztable and cepc fields. as Tables •     Profit_Center_Table – should contain List of ztable and cepc fields Is

  • Question on the Gapless Play feature

    I'm setting up my new 80gb and was curious if there was anyway to get iTunes to go through my libray and set up the gapless play. Right now I have to go through each album's and click that it is part of a gapless album. Any idea on if this can be don

  • Spotlight only showing results of 1 partition

    I skipped lion and went from Snow Leopard to Mountain Lion. I am using a 1tb External HD. If I type "screen shot" into spotlight, it only shows the files on 1 of the partitions (there are 4 partitions on the drive) The one thing I noticed is that if

  • File size doesn't update

    On my Win 2008 SP2 Enterprise x64 system I have a ftp application I'm running.  It is downloading a file.  When I look at the file in Windows Explorer or with the DOS dir command the file size + last modify time aren't current and can be many hours o