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

Thread: CAST without errors

  1. #1
    Join Date
    Jun 2005
    Posts
    1

    CAST without errors

    I am porting an application that currently hits MS SQL Server to Oracle. In one method, it generates sql to cast values from a column to another type, specified by the user.

    This works in MS SQL, because there CAST will return NULL if the conversion is invalid. The values that can be converted get converted, and those that don't simply become NULL. In Oracle, the statement simply returns an error that it can't cast the value.

    Is there a way to emulate the MS SQL behavior in Oracle?

  2. #2
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    You could wrap the CAST function up in a user-defined PL/SQL function to do this. The function can trap the errors
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

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