Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Oracle / MS SQLServer - string concatenation & other migration issues

Oracle / MS SQLServer - string concatenation & other migration issues

From: Douglas Reay <douglasr_at_chiark.greenend.org.uk>
Date: 20 Jul 2001 16:53:25 +0100 (BST)
Message-ID: <X4h*9tH1o@news.chiark.greenend.org.uk>

I have recently been tasked with taking a java application that runs against a database running on Oracle ( 8.1.5i ) and making it capable of running against both Oracle and Microsoft SQL Server ( 7.x or 2k ).

I was hoping that I could use SQLServer's user defined functions feature to define equivalents of some of Oracle's functions, rather than change the majority of the java code to have to be aware of the db type.

For example:

 In Oracle, if I want to concatenate two strings, I can do either:

    SELECT 'foo' || 'bar'
 or

    SELECT CONCAT( 'foo', 'bar' )
 while in SQLServer one uses:

    SELECT 'foo' + 'bar'

 Now, using SQLServer's UDFs I can do:

    CREATE FUNCTION concat ( @one varchar(1024), @two varchar(1024) )     RETURNS varchar(2048) AS
    BEGIN
      RETURN @one + @two
    END  But unfortunatly, that still leaves me having to call it as:

    SELECT douglas.CONCAT( 'foo', 'bar' )

Is there any way around this, or am I stuck with forking the java?


Second Question.

What other gotchas am I likely to come across, and are there any good resources listing the differences between the SQL from different databases?

Other things I've noticed differences in so far:

Douglas

-- 
By the way, getting sufficient compatability between Oracle & Postgres
was no problem
Received on Fri Jul 20 2001 - 10:53:25 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US