Easy question from MS SQL to ORACLE

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • antonopn
    New Member
    • Mar 2008
    • 42

    Easy question from MS SQL to ORACLE

    Hello there,

    I have this sql code that runs properly on sql server
    Code:
    select code+','+ name +','+afm+','+street1+','+zipcode1+','+phone11 from customer
    How can I transform it to run in an oracle database?
    Lets suppose the tables and columns are the same!

    Thnaks!
  • amitpatel66
    Recognized Expert Top Contributor
    • Mar 2007
    • 2358

    #2
    Replace a + sign with a || (double pipe) to run it in oracle

    Comment

    • antonopn
      New Member
      • Mar 2008
      • 42

      #3
      thanks for the immediate answer!
      I'm trying to use replicate function but it has errors.

      This is the sql server code!
      Code:
      select replicate(code, 1)+','+replicate(name, 1)+','+replicate(afm, 1)+','+replicate(street1, 1)+','+replicate(zipcode1, 1)+','+replicate(phone11, 1) from customer

      Comment

      • amitpatel66
        Recognized Expert Top Contributor
        • Mar 2007
        • 2358

        #4
        Originally posted by antonopn
        thanks for the immediate answer!
        I'm trying to use replicate function but it has errors.

        This is the sql server code!
        Code:
        select replicate(code, 1)+','+replicate(name, 1)+','+replicate(afm, 1)+','+replicate(street1, 1)+','+replicate(zipcode1, 1)+','+replicate(phone11, 1) from customer
        First you need to change the + sign to ||. Like this:

        [code=oracle]

        select code||','||name ||','||afm||',' ||street1||','| |zipcode1||','| |phone11 from customer

        [/code]

        Comment

        • antonopn
          New Member
          • Mar 2008
          • 42

          #5
          It Works Fine!

          Thanks A Lot!!!!!!

          Comment

          Working...