Equivalent of DB2  functions in ORACLE 11g

Hi,
I am trying to convert the SQL queries written in DB2 to ORACLE. There are some db2 specific functions are used in the queries.I am not able to find the equivalent function in ORACLE. The function names are written below:
1) DateDD()
2) SELECT @@IDENTITY
3) SELECT *
FROM (
SELECT ROWNUMBER() OVER() AS rowId_1, INNER_TABLE.*
FROM (----)as innertable
) AS Outertable
Error is: ROWNUMBER is INVALID identifier.
4) DAYOFWEEK()
5) DAYS()
6) dayofyear()
Please help me in finding the equivalent function in ORACLE.
Thanks in advance!!

You probably don't need a DateAdd function in Oracle. You can add a number to a date in Oracle-- that adds the number of days to the date.
SELECT sysdate today, sysdate+1 tomorrow
  FROM dualWhy are you using DAYS()? If, as in the example, you're just trying to determine the number of days between two dates, you can subtract dates in Oracle and the difference will be a number of days (including a fractional component if applicable)
SELECT date '2011-09-27' - date '2011-09-25' difference_in_days
  FROM dualIf you really need the number of days since January 1, 0001, you could subtract the date from Jan 1, 0001, i.e.
SELECT date '2011-09-27' - date '0001-01-01'
  FROM dualI would assume that Oracle and DB2 would return the same number but there could well be some differences since the current calendar didn't exist in the year 1 and I know there were issues in the transition from the Gregorian to the Julian calendar where some days were decreed not to exist. It wouldn't shock me if Oracle and DB2 counted some of the days in the 1500's differently.
Justin

Similar Messages

  • Subpartition with MOD Function in Oracle 11g

    Hi All,
    Can we create Subpartition based on MOD Function in Oracle 11g ?

    Hi!
    What are you refering with "MTS"? Anybody knows a term like this (except MultiThreaded Server).

  • Conversion functions in Oracle 11g Express;HEXTORAW &RAWTOHEX

    hi everybody !
    hextoraw ('0041') must return A but it doesn't return this value ,,it returns 0041
    I'm using Oracle 11g Express
    select hextoraw('0041') from dual; --> 0041 ? but must return A
    why is that ?
    please help me
    thank you

    Hextoraw takes your hexadecimal 41 and transforms to a single byte containing the decimal value 65 in a RAW datatype.
    But a RAW datatype can contain anything - it can be binary data, it can be text data.
    So your client cannot safely just show it as text - it performs an implicit rawtohex for you and displays the RAW data in hexadecimal form:
    SQL> select hextoraw('414243') val from dual;
    VAL
    414243You need to explicitly tell Oracle that this particular RAW value is actually text and not something binary.
    For that you can use a casting function:
    SQL> select utl_raw.cast_to_varchar2(hextoraw('414243')) val from dual;
    VAL
    ABCWhen cast to a varchar2, Oracle now knows it is text data and can display it.

  • Convert columns to row equivalent to stragg function in oracle sql

    Hi,
    Sorry i forgot my Oracle version :
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 64-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - ProductionI searched in google but i didn't found the solution.
    I looking for a function in discoverer equivalent to stragg sql function.
    Note : stragg function convert columns to rows.
    Thanks
    SELECT   deptno, stragg ('-' || ename)
        FROM emp_test
    GROUP BY deptno;
        DEPTNO STRAGG_STR                                                 
            10 -CLARK-KING-MILLER                                         
            20 -SMITH-FORD-ADAMS-SCOTT-JONES                              
            30 -ALLEN-BLAKE-MARTIN-TURNER-JAMES-WARD                      
    3 rows selected.Edited by: Salim Chelabi on 2010-01-29 08:32

    Hi again,
    *1- I created  my function in my schema.*
    CREATE OR REPLACE TYPE t_string_agg AS OBJECT
      g_string  VARCHAR2(32767),
      STATIC FUNCTION ODCIAggregateInitialize(sctx  IN OUT  t_string_agg)
        RETURN NUMBER,
      MEMBER FUNCTION ODCIAggregateIterate(self   IN OUT  t_string_agg,
                                           value  IN      VARCHAR2 )
         RETURN NUMBER,
      MEMBER FUNCTION ODCIAggregateTerminate(self         IN   t_string_agg,
                                             returnValue  OUT  VARCHAR2,
                                             flags        IN   NUMBER)
        RETURN NUMBER,
      MEMBER FUNCTION ODCIAggregateMerge(self  IN OUT  t_string_agg,
                                         ctx2  IN      t_string_agg)
        RETURN NUMBER
    SHOW ERRORS
    CREATE OR REPLACE TYPE BODY t_string_agg IS
      STATIC FUNCTION ODCIAggregateInitialize(sctx  IN OUT  t_string_agg)
        RETURN NUMBER IS
      BEGIN
        sctx := t_string_agg(NULL);
        RETURN ODCIConst.Success;
      END;
      MEMBER FUNCTION ODCIAggregateIterate(self   IN OUT  t_string_agg,
                                           value  IN      VARCHAR2 )
        RETURN NUMBER IS
      BEGIN
        SELF.g_string := self.g_string || ',' || value;
        RETURN ODCIConst.Success;
      END;
      MEMBER FUNCTION ODCIAggregateTerminate(self         IN   t_string_agg,
                                             returnValue  OUT  VARCHAR2,
                                             flags        IN   NUMBER)
        RETURN NUMBER IS
      BEGIN
        returnValue := RTRIM(LTRIM(SELF.g_string, ','), ',');
        RETURN ODCIConst.Success;
      END;
      MEMBER FUNCTION ODCIAggregateMerge(self  IN OUT  t_string_agg,
                                         ctx2  IN      t_string_agg)
        RETURN NUMBER IS
      BEGIN
        SELF.g_string := SELF.g_string || ',' || ctx2.g_string;
        RETURN ODCIConst.Success;
      END;
    END;
    SHOW ERRORS
    CREATE OR REPLACE FUNCTION string_agg (p_input VARCHAR2)
    RETURN VARCHAR2
    PARALLEL_ENABLE AGGREGATE USING t_string_agg;
    SHOW ERRORS
    *2- I ran my query in my schema with sqlplus.*
    SELECT deptno,ename,sal, string_agg(ename)over(partition by deptno) AS employees
    FROM   emp_test
    order by deptno;
        DEPTNO ENAME             SAL EMPLOYEES                                        
            10 CLARK            2450 CLARK,KING,MILLER                                
            10 KING             5000 CLARK,KING,MILLER                                
            10 MILLER           1300 CLARK,KING,MILLER                                
            20 JONES            2975 JONES,FORD,ADAMS,SMITH,SCOTT                     
            20 FORD             3000 JONES,FORD,ADAMS,SMITH,SCOTT                     
            20 ADAMS            1100 JONES,FORD,ADAMS,SMITH,SCOTT                     
            20 SMITH             800 JONES,FORD,ADAMS,SMITH,SCOTT                     
            20 SCOTT            3000 JONES,FORD,ADAMS,SMITH,SCOTT                     
            30 WARD             1250 WARD,TURNER,ALLEN,JAMES,BLAKE,MARTIN             
            30 TURNER           1500 WARD,TURNER,ALLEN,JAMES,BLAKE,MARTIN             
            30 ALLEN            1600 WARD,TURNER,ALLEN,JAMES,BLAKE,MARTIN             
            30 JAMES             950 WARD,TURNER,ALLEN,JAMES,BLAKE,MARTIN             
            30 BLAKE            2850 WARD,TURNER,ALLEN,JAMES,BLAKE,MARTIN             
            30 MARTIN           1250 WARD,TURNER,ALLEN,JAMES,BLAKE,MARTIN             
    14 rows selected.
    *3- I import this function in discoverer administration*
    4- My problem :When i use the function string_agg(ename)over(partition by deptno) in discover deskto i got the error you can't use over in this place.
    Any ideas.
    Thank in advance.
    Regards Salim.

  • Equivalent of to_date function in Ms SQL and using it in Evaluate function

    Hi,
    I am trying to find out a function in MS SQL which is equivalent to to_date function in oracle. Please find below the advanced filter i am trying to use in OBIEE.
    Evaluate('to_date(%1,%2)' as date ,SUBSTRING(TIMES.CALENDAR_MONTH_NAME FROM 1 FOR 3)||'-'||cast(TIMES.CALENDAR_YEAR as char(4)),'MON-YYYY')>=Evaluate('to_date(%1,%2)' as date,'@{pv_mth}'||'@{pv_yr}','MON-YYYY') and Evaluate('to_date(%1,%2)' as date ,SUBSTRING(TIMES.CALENDAR_MONTH_NAME FROM 1 FOR 3)||'-'||cast(TIMES.CALENDAR_YEAR as char(4)),'MON-YYYY') <=timestampadd(sql_tsi_month,4,Evaluate('to_date(%1,%2)' as date,'@{pv_mth}'||'@{pv_yr}','MON-YYYY'))
    The statement above works fines with oracle DB with to_date function. The same statement throws an error with MS SQL since to_date is not a built in function.
    With MS SQL I tried with CAST, not sure how to pass parameters %1 and %2.
    Please help me how to use Evaluate function and passing parameters along with to_date funtion in MS SQL.
    Regards!
    RR

    Hi,
    please refer to this thread for useful information on using to_char and to_date functions of oracle in MS SQL server:
    http://database.ittoolbox.com/groups/technical-functional/sql-server-l/how-to-write-to-to_char-and-to_date-sql-server-351831
    Hope this helps.
    Thanks,
    -Amith.

  • Dbms_lob.writeappend in Oracle 11g

    Hi,
    we have this line of code
    DBMS_LOB.writeappend(v_clob,doc_rec.seg_length,doc_rec.value) in our procedure.
    when we run this code in oracle10g ,its not taking thath much time.But when we run in oracle 11g,its taking time.
    I there any noncompatibility DBMS_LOB.writeappend for this function in oracle 11g.
    Thanks in advance

    thanks abufazal...
    actually after execution of below job, its not gathering the stats...
    i have checked using select LAST_ANALYZED,TABLE_NAME from dba_tables where OWNER='XXXXX';
    can anyone please suggest how to create job with scussful stats gather.
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB (
       job_name        => 'example_job1',
       job_type        => 'PLSQL_BLOCK',
       job_action      => 'BEGIN    
                             DBMS_STATS.gather_schema_stats("XXXXX", estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, cascade => TRUE);
                           END;',
       start_date      =>  TO_DATE('08-06-2013 18:00','DD-MM-YYYY HH24:MI'),
       repeat_interval => 'FREQ=DAILY;BYDAY=TUE;BYHOUR=18;BYMINUTE=0;BYSECOND=0',
       enabled         =>  TRUE,
       comments        => 'Gather table statistics');
    END;
    Can you provide output of the following query
    SQL> select job_name,job_action,start_date,last_start_date,last_run_duration,next_run_date,failure_count from dba_scheduler_jobs where job_name='EXAMPLE_JOB1';
    If the failure_count is > 0, please do share the errors from alert log file.

  • DB2 to Oracle 11g migration

    Hi,
    We are migrating the siebel database from DB2 to Oracle 11g.
    While doing the migration, the following values are found for the siebel related tables on DB2.
    for example:
    CREATE TABLE S_SERVICE_SCRPT (
    ROW_ID NVARCHAR2(15) NOT NULL,
    CREATED TIMESTAMP(9) DEFAULT CURRENT TIMESTAMP NOT NULL,
    CREATED_BY NVARCHAR2(15) NOT NULL,
    LAST_UPD TIMESTAMP(9) DEFAULT CURRENT TIMESTAMP NOT NULL,
    LAST_UPD_BY NVARCHAR2(15) NOT NULL,
    MODIFICATION_NUM DECIMAL DEFAULT 0 NOT NULL,
    CONFLICT_ID NVARCHAR2(15) DEFAULT gx'00030' NOT NULL,
    NAME NVARCHAR2(75) NOT NULL,
    PROG_LANG NVARCHAR2(30) NOT NULL,
    REPOSITORY_ID NVARCHAR2(15) NOT NULL,
    Please can anybody provide inputs how to get the equivalent for these gx___ values on Oracle 11g.
    Many thanks in advance

    Found a suitable link at IBM:
    http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db29.doc.sqlref/db2z_sql_declareglobaltemptable.htm
    gx is the hexadecimal graphic string constant - which is similar to our unistr function.
    Not sure which character is representated by 00030, but here's a method you can use to simply figure out the Oracle equivalent code point.
    First you need to figure out the DB2 character represented by the default value - let's assume it is '@'
    Assuming the NCHAR character set is UTF8 and the NLS character set is WE8MSWIN1252, then you can execute:
    select ascii('@') from dual;
    ASCII('@')
    64
    in SQL*Plus and you'll get the code point 64.
    Convert the 8bit code point to unicode using:
    SQL> select dump(convert(chr(64),'UTF8','WE8MSWIN1252'),16) from dual;
    DUMP(CONVERT(CH
    Typ=1 Len=1: 40
    and you can create the table with the default value represented by the hex value 0040:
    SQL> create table abc (col1 varchar2(20) default '@',
    2 col2 nvarchar2(20) default unistr('\0040'));
    Table created.
    SQL> insert into abc values (default,default);
    1 row created.
    SQL> select * from abc;
    COL1 COL2
    @ @

  • DB2 DIGIT  FUNCTION IN ORACLE

    What is the DB2 DIGIT FUNCTION equivalent in ORACLE database. We have done a migration from db2 to oracle and many programs just fails where I encounters digit function. Is there any workaroud or function present in oracle database which makes the program working.
    Just share your knowledge .
    [email protected]

    Addendum ...
    OK I found what the DIGIT function does.
    I am not sure if there is a function in Oracle that maps directly to DIGIT function in DB2
    but you can do something like this:
    select lpad(replace(to_char(abs(n)),'.'),
    (select to_number(data_precision) from user_tab_columns where table_name = 'A' and column_name = 'N'),'0')
    from a
    In the SQL above n is the column in table A. Data_precision column gets the size of the column.
    Option 2:
    You could write your own function in Oracle to do what the SQL above does
    create or replace function digit (col_val in number, col_name IN varchar2, tab_name IN varchar2) return varchar2
    as
    v_val varchar2(100);
    v_prec number;
    begin
    select to_number(data_precision) into v_prec from user_tab_columns where table_name = upper(tab_name) and column_name = upper(col_name);
    v_val := lpad(replace(to_char(abs(col_val)),'.'),v_prec,'0');
    return v_val;
    end;
    Then use the function as follows:
    select digit(n,'N','A') from a
    Shakti
    http://www.impact-sol.com
    Developers of Guggi Oracle - Tool for DBAs and Developers
    Message was edited by:
    skgoel

  • Query not considering function based index in oracle 11g

    I have a query which used Function Based Index when run in oracle 9i but when I run the same query
    without any changes, it does not consider index. Below is the query:
    SELECT distinct patient_role.domain_key, patient_role.patient_role_key,
    patient_role.emergency_contact_name,
    patient_role.emergency_contact_phone, patient_role.emergency_contact_note,
    patient_role.emergency_contact_relation_id,
    patient_role.financial_class_desc_id, no_known_allergies, patient_role.CREATED_BY,
    patient_role.CREATED_TIMESTAMP,
    patient_role.CREATED_TIMESTAMP_TZ, patient_role.UPDATED_BY, patient_role.UPDATED_TIMESTAMP,
    patient_role.UPDATED_TIMESTAMP_TZ,
    patient_role.discontinued_date
    FROM encounter, patient_role
    WHERE patient_role.patient_role_key = encounter.patient_role_key
    AND UPPER(TRIM(leading :SYS_B_0 from encounter.account_number)) = UPPER(TRIM(leading :SYS_B_1 from
    :SYS_B_2))
    AND patient_role.discontinued_date IS null
    AND encounter.discontinued_date IS null ;
    Index definition:
    CREATE INDEX "user1"."IX_TRIM_ACCOUNT_NUMBER" ON "user1."ENCOUNTER" (UPPER(TRIM(LEADING
    '0' FROM "ACCOUNT_NUMBER")), "PATIENT_ROLE_KEY", "DOMAIN_KEY", "DISCONTINUED_DATE")
    PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
    BUFFER_POOL DEFAULT)
    TABLESPACE "user1"
    Database : Oracle 11g (11.2.0.3)
    O/S : Linux 64 bit (the query does not consider index even on windows os)
    Any suggestions?
    -Onkar
    Edited by: onkar.nath on Jul 2, 2012 3:32 PM

    Onkar,
    I don't appreciate you posting this question in several forums at the same time.
    If I would know you also posted this on Asktom, I wouldn't even have bothered.
    As to your 'issue':
    First of all: somehow cursor_sharing MUST have been set to FORCE. Oracle is a predictable system, not a fruitmachine.
    Your statement the '0' is replaced by a bind variable anyway is simply false. If you really believe it is not false, SUBMIT a SR.
    But your real issue is not Oracle: it is your 'application', which is a mess anyway. Allowing for alphanumeric numbers is a really bad idea.
    Right now you are already putting workaround on workaround on workaround on workaround.
    Issue is the application: it is terminal., and you either need to kill it, or to replace it.
    Sybrand Bakker
    Senior Oracle DBA

  • Oracle 11g Table function returns no records on first call

    Hello,
    On a Oracle 11g R2 I've a table function ( PIPELINED ) returning rows selected from a table.
    The first time the function is selected, in a session ( I've tried to disconnect and log in again ), it returns no rows.
    I've tried to log the call using DBMS_OUTPUT and from what I see the select on the table function returns no rows and no output is printed. So I presume Oracle is not calling the function.
    The same function on a similar environment ( same db versions, patches and database structure ) works fine. The second environment is a production environment so it has more memory and some other settings enabled.
    Does anyone know of settings that can relate to this behaviour ?
    Thanks in advance for the help.
    Regards,
    Stefano Muret

    Thank you for answering so fast.
    Here's the function code:
    FUNCTION template_parameters (iTemplate IN TEMPLATE_RAW_DATA.TMPL_ID%TYPE := NULL)
    RETURN table_type_tmpl_parameters PIPELINED
    IS
    li_exception INTEGER DEFAULT -20025;
    POUT_PARM TABLE_TYPE_TMPL_PARAMETERS;
    lt_parms table_type_tmpl_parms_raw;
    sParmCheck VARCHAR2(4000);
    iOccurrence INTEGER;
    BEGIN
    pOut_Parm := table_type_tmpl_parameters();
    pOut_Parm.EXTEND;
    select
    tmpl_id
    *,tmpl_name*
    *,replace(upper(trim(sql_out)),'[SCHEMA].')*
    *,UPPER(TRIM(out_tmpl_parms))*
    bulk collect into lt_parms
    from ref_templates
    where tmpl_id = NVL(iTemplate,tmpl_id)
    order by tmpl_id;
    FOR k IN 1..lt_parms.COUNT
    LOOP
    pOut_Parm(1).tmpl_id := lt_parms(k).tmpl_id;
    pOut_Parm(1).tmpl_name := lt_parms(k).tmpl_name;
    FOR i IN 1..2
    LOOP
    IF i = 1 THEN
    sParmCheck := lt_parms(k).sql_out;
    ELSE
    sParmCheck := lt_parms(k).sql_parms;
    END IF;
    iOccurrence := 1;
    *pOut_Parm(1).parameter_name := regexp_substr(sParmCheck,'\[[^\[]+\]',1,iOccurrence);*
    WHILE pOut_Parm(1).parameter_name IS NOT NULL
    LOOP
    PIPE ROW (pOut_Parm(1));
    iOccurrence := iOccurrence + 1;
    *pOut_Parm(1).parameter_name := regexp_substr(sParmCheck,'\[[^\[]+\]',1,iOccurrence);*
    END LOOP;
    END LOOP;
    END LOOP;
    RETURN;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR(li_exception,SUBSTR(SQLERRM,1,1000));
    RETURN;
    END template_parameters;
    This function is part of a package.
    The data on both environments is the same.

  • How to call a javascript function from oracle apex 3.2.1 (oracle 11g)

    Hello ,
    I want to use javascript for client side validations in oracle apex 3.2.1 and i am using oracle 11g.
    how to call a function for a submit button where i will validate the existance of data for a control and submit the page once validated.
    where to place the call to a fucction and where the function need to be written.
    please give me a sample code...
    i am new to oracle apex.
    thanks/

    Hi,
    This might help
    http://download.oracle.com/docs/cd/E14373_01/appdev.32/e13363/javascript.htm#CIHEBFFC
    Br,Jari

  • Oracle 11G,10g and DB2 replication?

    Oracle 11G,10g and DB2 replication?
    =======================================
    We are using Oracle 11gR2. We have a table in Oracle filled with partial data (over 200K+, it may grow to 1M). The rest need to be obtained from DB2. It is not from one DB2 table.
    The DB2 is configured to run Oracle 10g within it. We have given http interface, where we need to supply(Push) the partial data using HTTP_UTIL package for each row, then DB2/Oracle 10g return the result as XML.
    It is a network heavy, slow and not reliable.
    Are we able to replicate tables between Oracle 11g and DB2/oracle 10g?
    We like to leverage the features on 11gR2 effectively.
    I find some interesting folks in this forum.
    Did anyone face such situation?
    I like to know the best approach with good performance options.
    Any idea?
    Thanks in helping.

    qwe16235 wrote:
    The DB2 is configured to run Oracle 10g within it. We have given http interface, where we need to supply(Push) the partial data using HTTP_UTIL package for each row, then DB2/Oracle 10g return the result as XML.
    Any idea?http://en.wikipedia.org/wiki/Rube_Goldberg_machine
    why is DB2 required to produce XML?

  • DB2 8.1 to Oracle 11g with SQL Developer 3.0

    Hi,
    I started migrating my DB2 8.1 to Oracle 11g, with SQL Developer 3.0
    Basically, I need to migrate TABLES.
    I followed these steps:
    1) I created a new Oracle database, tablespaces, users, etc.
    2) Then, I created both (DB2 and Oracle) connections into SQL Developer 3.0. All works fine.
    3) I start capturing one table with the "Copy to Oracle" feature. Done with no errors.
    But when I compare the table structure, I see the following problems in Oracle:
    a) All fields are NULLABLE = YES. SQL Developer show this field property correctly in DB2: NULLABLE = NO, but not migrated the same!
    SOLUTION: All I want is that SQL Developer simply migrating the same value who I have in the DB2. But how?
    b) In DB2 I have one field property called COLUM DEFAULT. In Oracle this property is called DATA_DEFAULT. The SQL Developer show this field property correctly for the DB2 tables (for example: 0.0, ' ', etc), but don't migrated the same value! All fields are configured to DATA_DEFAULT = NULL.
    SOLUTION: I think this occurs because NULLABLE is migrated with the value YES. Well, all I need is the same above...
    NOTE: I tested the SWISSQL DATA MIGRATION software, and it works fine. All tables, field properties and data are migrated sucessfull. But this program is trial version!
    Well, I think all of this are BUGS into SQL Developer.
    Please, anyone to help me?
    Regards,
    Ylram

    Welcome to the forum!
    >
    I just did right click in the procedure body and found [Debug, Compile for Debug, Compile, Run].
    >
    You listed a bunch of things but you didn't say what steps you actually performed and what the result was.
    Did you 'Compile'the procedure? until you compile the procedure you can't debug it.
    I just created a new procedure and when I select the body it displays in the 'Code' window on the right. But the 'Debug' icon is not enabled because the procedure was not compiled for debug.
    When I compile it for debug the 'Debug' icon is now enabled.

  • Equivalent of this db2 syntax in oracle?

    Can somebody please tell me what is the equivalent of the following in oracle:
    SELECT X.*
    FROM XMLTABLE (xmlnamespaces (DEFAULT "http://posample.org"),
    'db2-fn:xmlcolumn("CUSTOMER.INFO")/customerinfo'
    COLUMNS "CUSTNAME" CHAR(30) PATH 'name',
    "PHONENUM" XML PATH 'phone')
    as X
    I took this from http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.apdv.embed.doc/doc/c0023903.htm.
    Thx!

    SELECT X.*
    FROM XMLTABLE
    xmlnamespaces (DEFAULT "http://posample.org"),
    '/customerinfo' passsing "CUSTOMER.INFO"
    COLUMNS
    "CUSTNAME" VARCHAR2(30) PATH 'name',
    "PHONENUM" XMLTYPE PATH 'phone'
    ) x

  • Connect to DB2 from oracle 11g on windows 2008 server

    Hi Folks,
    I want to conenct to DB2 from oracle 11g using DB link.
    DB2 :
    user : db2user
    pwd : db2pwd
    database : db2database (OSBLDEV)
    able to connect to db2 server (installed on machine M1) using db2 client with above details from machine M2 (where oracle is installed).
    Oracle :
    user : orauser
    pwd : orapwd
    host : orahost
    port : 1521
    service : oraservice
    able to connect to oracle server using oracle sql developer with above details on Machine M2 (windows 2008 server)
    when i execute the query with database link
    select row_id from siebel.s_org_ext@OSBLDEV;
    I get the message : ORA-12154: TNS:could not resolve the connect identifier specified.
    could you pls check and let me know whether the below enteries are correct or not.
    Pls share if you have step by step connectivity from DB2 to oracle using DB link.
    1. I have created the Data source for DB2 - test successful
    create database link OSBLDEV
    connect to "db2user"
    identified by "ldb2pwd"
    using 'OSBLDEV';
    1. I have made the following entry in E:\oracle\product\11.1.0\db_1\hs\admin\initosbldev.ora
    HS_FDS_CONNECT_INFO = OSBLDEV
    HS_FDS_TRACE_LEVEL = 0
    2. I have made the following entry in E:\oracle\product\11.1.0\db_1\NETWORK\ADMIN\tnsnames.ora
    OSBLDEV =
    (DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST=orahost)(PORT=1521))
    (CONNECT_DATA=(SID=OSBLDEV))
    (HS=OK)
    3. I have made the following entry in E:\oracle\product\11.1.0\db_1\NETWORK\ADMIN\listener.ora and releoaded the listner (lsnrctl reload)
    LISTENER =
    (ADDRESS_LIST=
    (ADDRESS=(PROTOCOL=tcp)(HOST=orahost)(PORT=1521))
    (ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))
    SID_LIST_LISTENER=
    (SID_LIST=
         (SID_DESC = # this is the entry for HSODBC
         (SID_NAME = OSBLDEV)
         (ORACLE_HOME = e:\oracle\product\11.1.0\db_1)
         (PROGRAM = hsodbc)
    Thanks in advance.

    1. My listener.ora is placed at the below location:
    E:\oracle\product\11.1.0\db_1\NETWORK\ADMIN
    2. I have modifed the listener and removed the entry - hsodbc
    3. stop and start the listener.
    still can't see the service entry in listener status.
    C:\>lsnrctl status
    LSNRCTL for 64-bit Windows: Version 11.1.0.7.0 - Production on 19-JUL-2010 02:27
    :08
    Copyright (c) 1991, 2008, Oracle. All rights reserved.
    Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
    STATUS of the LISTENER
    Alias LISTENER
    Version TNSLSNR for 64-bit Windows: Version 11.1.0.7.0 - Produ
    ction
    Start Date 19-JUL-2010 02:21:17
    Uptime 0 days 0 hr. 5 min. 52 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Log File e:\oracle\diag\tnslsnr\DALDEVDBCRM1\listener\alert\log
    .xml
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=daldevdbcrm1.corp.nai.org)(PORT=1521
    Services Summary...
    Service "+ASM" has 1 instance(s).
    Instance "+asm1", status READY, has 1 handler(s) for this service...
    Service "+ASM_XPT" has 1 instance(s).
    Instance "+asm1", status READY, has 1 handler(s) for this service...
    Service "ARIBADEV" has 1 instance(s).
    Instance "ariba", status READY, has 1 handler(s) for this service...
    Service "ARIBADEV_XPT" has 1 instance(s).
    Instance "ariba", status READY, has 1 handler(s) for this service...
    Service "ARIBAXDB" has 1 instance(s).
    Instance "ariba", status READY, has 1 handler(s) for this service...
    Service "aiad.corp.nai.org" has 2 instance(s).
    Instance "aiad1", status READY, has 2 handler(s) for this service...
    Instance "aiad2", status READY, has 1 handler(s) for this service...
    Service "aiadXDB.corp.nai.org" has 2 instance(s).
    Instance "aiad1", status READY, has 1 handler(s) for this service...
    Instance "aiad2", status READY, has 1 handler(s) for this service...
    Service "aiad_XPT.corp.nai.org" has 2 instance(s).
    Instance "aiad1", status READY, has 2 handler(s) for this service...
    Instance "aiad2", status READY, has 1 handler(s) for this service...
    Service "aianew" has 1 instance(s).
    Instance "aianew", status READY, has 1 handler(s) for this service...
    Service "aianewXDB" has 1 instance(s).
    Instance "aianew", status READY, has 1 handler(s) for this service...
    Service "aianew_XPT" has 1 instance(s).
    Instance "aianew", status READY, has 1 handler(s) for this service...
    The command completed successfully
    C:\>

Maybe you are looking for

  • IPad won't sync podcasts marked 'explicit'

    I've had tons of trouble syncing podcasts to my iPad2. I thnave 21 appearing in iTunes, and on the iPad as it's listed in iTunes. But on the actual iPad there are only 5 showing. Is it a coincidence that these are the only 5 that are not marked 'expl

  • DW CS5 problem- Windows XP - window not showing up - only frame

    I installed Dreamweaver CS5 on my older (5 yrs) Sony Vaio laptop with a Pentium M processor and 2 gig of ram running Windows XP Home with Service Pack 3. When Dreamweaver launches, there is that green box/shape that shows up while the program starts

  • * of 165 files to be updated, but won't put them on

    I am trying to add new songs to my new iPhone and they will not go across from my itunes, i continue adding other songs and the number of 'files being updated' increases but never gets smaller

  • Prepared Statement error, someone plz help

    strQuery = qryProvide.supplyNotReceivedQuery(); logObject.log("CompDataProvider","supplyNotReceivedRecords",strQuery, XMLMON_Constants.LOG_DEBUG); stmtRestSchema = con.prepareStatement(strQuery); stmtRestSchema.setString(1,loadingPoint.trim()); stmtR

  • How to maintain customer groups 1,2,3,4,5 ?

    Hi experts, We want to maintain customer group 1, customer group 2, customer group 3,customer group 4,customer group 5 against the customer in the customer master. In which transaction code we can do that. Please provide me a step by step for maintai