DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: Query

  1. #1
    Join Date
    Apr 2001
    Posts
    60
    Hi
    I have a column with the value 'Mon-Tue-Wed-Thu'.
    If day of sysdate matches with the any one of the day with the column value, my query should return a value. How do i do it?
    rammi

  2. #2
    Join Date
    Jan 2002
    Location
    Up s**t creek
    Posts
    1,525
    Match the column value with:

    substr(to_char(sysdate,'Day'),1,3)

    Regards

    Jim
    Oracle Certified Professional
    "Build your reputation by helping other people build theirs."

    "Sarcasm may be the lowest form of wit but its still funny"

    Click HERE to vist my website!

  3. #3
    Join Date
    Apr 2001
    Posts
    60
    Hi
    I cant write a query like
    Select * from test where dday like substr(to_char(sysdate,'Day'),1,3). Pl remember that 'Wed' value in the column is somewhere in the middle.

    rammi

  4. #4
    Join Date
    Apr 2001
    Location
    Czechia
    Posts
    712
    Select * from test where dday like '%'||substr(to_char(sysdate,'Day'),1,3)||'%'
    or, if you like
    select * from test where instr(dday, substr(to_char(sysdate,'Day'),1,3))>0
    Ales
    The whole difference between a little boy and an adult man is the price of toys

  5. #5
    Join Date
    Sep 2000
    Location
    Chennai, India
    Posts
    865
    Hi

    Check this out...

    Code:
    select dday from ramya where dday like concat(concat('%',(substr(to_char(sysdate,'Day'),1,3))),'%') 
    /
    Cheers

  6. #6
    Join Date
    Jan 2002
    Location
    Up s**t creek
    Posts
    1,525
    You could do the following

    SELECT *
    FROM test
    WHERE INSTR(ddate, SUBSTR(TO_CHAR(SYSDATE,'Day'),1,3)) > 0

    Regards
    Jim
    Oracle Certified Professional
    "Build your reputation by helping other people build theirs."

    "Sarcasm may be the lowest form of wit but its still funny"

    Click HERE to vist my website!

Posting Permissions

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


Click Here to Expand Forum to Full Width