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

Thread: Error on datatype

  1. #1
    Join Date
    May 2008
    Posts
    2

    Error on datatype

    Hi Guys,

    I have a problem whereby i got below error once i execute my query.

    'ORA-01790: expression must have same datatype as corresponding expression'


    i would like to create a column with no data in it and union with another query which the datatype is date.
    please find below queries.

    select rsh.receipt_num reciept_no, '' transfer_date from RCV_SHIPMENT_HEADERS rsh, RCV_TRANSACTIONS rv where rv.shipment_header_id = rsh.shipment_header_id
    union
    select rsh.receipt_num reciept_no, nvl(rvD.transaction_date, null) transfer_date from RCV_SHIPMENT_HEADERS rsh, RCV_TRANSACTIONS rv where rv.shipment_header_id = rsh.shipment_header_id


    thanks
    ahbo01

  2. #2
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,555
    Please be aware this is the last time I work in a non-formatted query of yours.


    1- Try this...
    Code:
    select  rsh.receipt_num reciept_no, 
            decode(TO_DATE('01/01/2050','mm/dd/yyyy'),TO_DATE('01/01/2050','mm/dd/yyyy'),NULL) transfer_date 
    from    RCV_SHIPMENT_HEADERS rsh, 
            RCV_TRANSACTIONS rv 
    where   rv.shipment_header_id = rsh.shipment_header_id
    union
    select  rsh.receipt_num reciept_no, 
            nvl(rvD.transaction_date, null) transfer_date 
    from    RCV_SHIPMENT_HEADERS rsh, 
            RCV_TRANSACTIONS rv 
    where   rv.shipment_header_id = rsh.shipment_header_id
    ;
    2- Could you please let us know why are you using that NVL() function?.. do you really want to show NULLs when you already have NULLs?
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

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