Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2009
    Posts
    55

    Unanswered: compare two number,varchar column in two table

    Hi,
    I have two tables with number,varchar column.
    SQL> desc ckm1
    Name Null? Type
    ----------------------------------------- -------- ----------------------------
    N_COMP_ID NOT NULL NUMBER(10)
    C_COMP_NAME NOT NULL VARCHAR2(120)
    C_HOSTNAME VARCHAR2(20)
    N_FRWK_COMP_FLAG NOT NULL NUMBER(1)
    C_COMP_ENV VARCHAR2(1024)
    SQL> desc ckm2
    Name Null? Type
    ----------------------------------------- -------- ----------------------------
    N_COMP_ID NOT NULL NUMBER(10)
    C_COMP_NAME NOT NULL VARCHAR2(120)
    C_HOSTNAME VARCHAR2(20)
    N_FRWK_COMP_FLAG NOT NULL NUMBER(1)
    C_COMP_ENV VARCHAR2(1024)
    Is there any function similar to "dbms_lob.compare”..
    So, two field of two text column in different table can be compared??
    Any example ??
    Any advice on this??
    Any comment

  2. #2
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Quote Originally Posted by chuikingman View Post
    So, two field of two text column in different table can be
    What's wrong with = and <> ?

  3. #3
    Join Date
    Aug 2009
    Posts
    55
    Quote Originally Posted by shammat View Post
    What's wrong with = and <> ?
    Any example ????

  4. #4
    Join Date
    Mar 2007
    Posts
    623
    Quote Originally Posted by chuikingman View Post
    Is there any function similar to "dbms_lob.compare”..
    So, two field of two text column in different table can be compared??
    Any example ??
    No need for function, as simple comparison operator (=) is available, so it is as easy as writing (a=b).
    More examples are provided e.g. in SQL Reference book, available with other Oracle documentation e.g. online on http://tahiti.oracle.com/
    Quote Originally Posted by chuikingman View Post
    Any advice on this??
    Any comment
    Compare columns/values of the same type. If their types differ, explicitly convert one of them (e.g. using TO_CHAR, TO_NUMBER or TO_DATE function).
    Note that two NULLs are not equal; if you want them to be, you have to specifically check (IS NULL) and treat it, e.g.
    Code:
    ((a IS NULL AND b IS NULL) or (a=b))

  5. #5
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Quote Originally Posted by chuikingman View Post
    Any example ????
    Have you ever written a piece of SQL before?
    Please refer to the SQL manual (flyboy posted the link)
    You need to do a bit of work yourself

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •