Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Migrating from Oracle to SQL

Migrating from Oracle to SQL

Scheduled Pinned Locked Moved Database
databaseoracledebugginghelptutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Arudya
    wrote on last edited by
    #1

    Hi I am trying to convert an Oracle query to SQL. But i am totally confused thinking how to proceed. For some of the oracle packages , am not able to find an equivalent SQL function Here is my Oracle query cursor c_fields(c_xml XMLTYPE) is select DBMS_XMLGEN.convert(extract(value(x), '//field/@name').getstringval(),1) FLD_NAME, extract(value(x), '//field/@resultCol').getstringval() RESULT_COL, extract(value(x), '//field/fieldConfiguration/@isAttachmentAllowed').getnumberval() AllOW_ATTACHMENT, extract(value(x), '//field/@key').getnumberval() FLD_ID from TABLE(XMLSEQUENCE(EXTRACT(c_xml, '//table/field'))) x; I need to convert this to SQL query. In SQL we dont have parameterized cursor concepts. However to some extent we can achieve the functionality by using "WHERE" condition. But in this query, am not able to trace out how can i write the equivalent SQL functionality since "FROM" part itself is using the parameterized cursor. Please help. Thanks Arudya

    J 1 Reply Last reply
    0
    • A Arudya

      Hi I am trying to convert an Oracle query to SQL. But i am totally confused thinking how to proceed. For some of the oracle packages , am not able to find an equivalent SQL function Here is my Oracle query cursor c_fields(c_xml XMLTYPE) is select DBMS_XMLGEN.convert(extract(value(x), '//field/@name').getstringval(),1) FLD_NAME, extract(value(x), '//field/@resultCol').getstringval() RESULT_COL, extract(value(x), '//field/fieldConfiguration/@isAttachmentAllowed').getnumberval() AllOW_ATTACHMENT, extract(value(x), '//field/@key').getnumberval() FLD_ID from TABLE(XMLSEQUENCE(EXTRACT(c_xml, '//table/field'))) x; I need to convert this to SQL query. In SQL we dont have parameterized cursor concepts. However to some extent we can achieve the functionality by using "WHERE" condition. But in this query, am not able to trace out how can i write the equivalent SQL functionality since "FROM" part itself is using the parameterized cursor. Please help. Thanks Arudya

      J Offline
      J Offline
      jschell
      wrote on last edited by
      #2

      My first choice would be to refactor the database unless that code is touched very seldom. That sort of meta data solution is very inefficient. But after that I would use dynamic sql. You create a varchar with equivalent sql in it, specifically the extracted table name. I would probably extract the rest as well. Then you use 'execute' to execute the varchar.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups