Oracle from DB2 federation - function mapping

I need to map an Oracle function (instr) from an InfoSphere function (postion) from the DB2 database, so this is more of a DB2 question, but never could get an answer out of DB2ools ;-)
I have created the wrapper, server, user mapping and nicknames in DB2, but need to create a function mapping in DB2 between their "position(search, source, code) to our instr(search, source). This is a mapping of system functions, so I am not sure if it is possible... and their documentation is kludgy at best. The problem is this: POSITION(search, source, code), where code represents UTF-16, UTF-32 or code page translation. I want to force this syntax to pass to Oracle as INSTR(search, source), dropping their 'code'.
This is the only function that does not work properly from the DB2 side to us. If anyone has the DB2 create function mapping command to do the above, my appreciation for the answer and condolences that you actually had to go thru the reams of IBM documentation.

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

Similar Messages

  • Querying Oracle DB from DB2

    Is anyone using Heterogenous Services to query Oracle from DB2?
    We have been using the dblink to our mainframe z/OS DB2 databases successful for quite some time and can insert into DB2 as well, but have many mainframe programs that would be simplified by pulling from Oracle directly.
    Any suggestions are appreciated.

    No, I'm using Heterogenous Services to query DB2 from Oracle..

  • Migration map from DB2 MVS to oracle

    Hi there,
    I am looking for more details for OMWB,
    if it could be used to migrate from DB2 MVS to oracle,
    and especially concerned about the mapping procedure,
    also concerned about volume and speed as for about millions of records /rows are involved.
    How much the OMWB can help?
    Please help.......:~
    Thanks
    and regards.

    Hi there,
    Thank you very much for your reply,
    also,
    can the OMWB for DB2/400 also works for DB2/MVS?
    is there utility in OMWB exists for the mapping procedure?
    thanks a lot.

  • 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

  • Oracle equivalent of DB2 DIGITS function

    IBM DB2 has a DIGITS SQL function that returns a character-string representation of a number, with the following properties:
    The result of the function is a fixed-length character string representing the absolute value of the argument without regard to its scale. The result does not include a sign or a decimal character. Instead, it consists exclusively of digits, including, if necessary, leading zeros to fill out the string.
    For example, for a NUMBER(6,2) column with value -6.28, the string '000628' is returned.
    Is there an equivalent SQL function available in Oracle 10g? Or if there's no equivalent, how can this be done in Oracle 10g?

    So, looks like behavior of DIGITS function depends not only on the value of the parameter passed, but also on the datatype of the actual parameter (implicitly derived from the datatype of the column name being passed).
    In other words, you can not simply call DIGITS (-6.18) because the result could be different for different precision/scale combinations:
    NUMBER(6,2) -> 000618
    NUMBER(3,2) -> 618
    NUMBER(6,3) -> 006180
    I don't think Oracle has a mechanism of accessing the datatype of the actual argument from within the function (?)
    So, you would need to pass the precision and scale of the argument datatype separately:
    create or replace function digits (n number, precision number, scale number) return varchar2 as
    begin
    return lpad (abs(n)*power(10,scale),precision, '0');
    end;
    SQL> select digits (-6.18, 6, 3) from dual;
    006180
    SQL> select digits (-6.18, 3,2) from dual;
    618
    SQL> select digits (-6.18, 6,2) from dual;
    000618
    To replace DIGITS in your DB2 code, you would need to build a conversion that would look up the precision and scale of the column for each call and substitute them into the call accordingly.

  • Migration from DB2 to Oracle issue

    Hi
    I'm migrating an old legacy system from DB2 to Oracle but have the following trouble:
    The queries that the app executes have some DB2-specific syntax such as DATE function, example:
    select * from TABLE where date_col > DATE('2010/01/01');
    The above query works on DB2 but not in Oracle (should be changed to use TO_DATE function but this is not possible initially)
    I could create a function in the Oracle db called DATE, something like:
    create function date (p_date varchar2) return date is
    begin
    return to_date(p_date)
    end date;
    create public synonym date for sys.date;
    But DATE is a reserved word and I can't use it as function name
    Do you know any way of making the above query work against an Oracle db or transforming the query text before being parsed?
    Thanks a lot in advance
    --Guillermo                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    As you stated and mentioned in the manual:
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10830/appb.htm
    DATE is a reserved word and thus you need to recode the statement. For example the migration utility is commonly adding an underscore to the function - and this requires again a recoding of the source statements.

  • Migration from DB2 database to Oracle 10g

    Hi All,
    We are working on migration of database from DB2 to Oracle 10g all from scrap. Could you please suggest the steps need to follow up with this and also suggest if any migration tools are available for this task. I am already in a mess of doing it manually. Please help me at the earliest possible.

    You can check the list here
    http://www.oracle.com/technology/tech/migration/workbench/files/mig_rel10104.html
    stored procedure, No
    view depends.

  • Database link from oracle to db2

    Can any help me to create a database link from oracle to db2. It would be greatful if you can provide me detail steps

    <p>You don't give us much information to go on. What version of Oracle? What platform is DB2 running on? You might want to take a look at <b>this</b>. You might also look <b>here</b> and <b>here</b>.</p>
    Tom

  • Migrate from DB2 7 to Oracle 10G(R1)

    Hi, all.
    I have a big DB2 db. When Oracle and DB2 set up on different computers, OMWB works good. When i install Oracle and DB2 on one system UDB7 driver not work - on step "Source Database details", when i enter user ID/pass and database name, then do nothing :(.
    How explane it?
    User information correct. DB2 ODBC driver - worked...
    Can you help me?

    Are you missing a zip file, or are using an unsupported by omwb version of the zip file/driver?
    That is what is suggested by a java.lang.NoClassDefFoundError found message from Java.
    It is also possible, but less likely, that some corporate anti-virus/security software has changed the software. There was a post concerning that possibility recently months ago. [search for www.trend.com on this forum:  Urgent help-Unable to login into OMWB
    Posted: Jan 30, 2007 11:23 PM]
    From the User Guide:
    Before Migrating From IBM DB2 UDB
    To configure an IBM DB2 UDB database for migration:
    1.
    Install the IBM DB2 UDB Client software on the same system as Migration Workbench.
    This automatically installs the IBM DB2 UDB JDBC driver contained in the db2java.zip file.
    Note:
    Migration Workbench supports the use of either the JDBC 1.2 or JDBC 2.0 compliant IBM DB2 UDB JDBC driver.
    2.
    Copy the db2java.zip file to the following directory:
    OMWB_install_dir/Omwb/drivers
    3.
    Make sure that you can login to the IBM DB2 UDB database with a user name that has database administrator privileges.
    Regards,
    Turloch

  • Re Migrating from Oracle to DB2

    Hi All,
    We are migrating from Oracle to DB2, so just wanted to know what will be the impact when we do this, i mean what all necessary steps should be taken to do so. I am a technical consultant involved in this project so not much idea regarding this.
    Also please let me know will it effect the custom i mean the Z programs that we have created. Please let me know regarding this.
    Thanks and Regards,
    Salish.

    > We are migrating from Oracle to DB2, so just wanted to know what will be the impact when we do this, i mean what all necessary steps should be taken to do so. I am a technical consultant involved in this project so not much idea regarding this.
    A heterogeneous migration (changing database and/or operating system) implies a certified migration consultant doing the migration, otherwise you'll loose support from SAP for problems during the migration and for the target system (http://service.sapcom/osdbmigration --> FAQ).
    > Also please let me know will it effect the custom i mean the Z programs that we have created. Please let me know regarding this.
    Depending on how you access the data you may need to increase/delete indexes or change the programs to get a better speed.
    Markus

  • PeopleSoft CRM 8.8 migration from DB2 UDB v8.1x to Oracle 9i Rac

    Hello,
    What is the best way to migrate a PeopleSoft CRM 8.8 application (PeopleTools 8.44) from DB2 UDB v8.1x to Oracle 9i Rac? From what I can tell I have either two options; 3rd party software or data mover. Is there a Workbench tool to do this job or is data mover my best bet.... Just an FYI...The database size is around 100GB...
    Thanks

    I would suggest that you get in contact with your Oracle account team with this request. We have groups inside Oracle with have experience migrating databases underneath PeopleSoft applications. They would be able to provide you with the best advice and assistance if required.
    Donal

  • Help on Migration from DB2 version 8.1 to Oracle 10g

    Hi All
    We have one requirement of migrating one Mainframe database to Oracle 10g. the DB version is DB2 8.1 on Z OS. We are thinking of using Oracle Migration workbench. Can someome help me know if this is supported by OMWB tool or not. I checked in oracle site, they have mentioned some details about V4R5. Could not conclude. Please confirm this. Also let me know if there is any tool that we can use or we have to go manually. Any pointrs would be highly appreciated.
    Thanks,
    Prashant

    OMWB nor its follow up product SQL Developer Migration workbench support DB2 z/OS migrations. You have to do them "manually".
    For a manual migration you might use an Oracle Gateway which allows you to use an Oracle database link to the Db database and you can then use the gateway to copy the data from Db2 to Oracle. Another alternative would be to unload the DB2 data into an ascii file and to load it into the Oracle database using SQL*Loader. You might also use Golden Gate which is commonly used to replicate data between Oracle and DB2 - but it allows you also to use it as a migration utility.
    There are also Oracle partners that can assist you with the migration - please have a look at:
    http://www.oracle.com/technetwork/database/migration/index-084442.html

  • Migration from Oracle to DB2 UDB on Unix

    Hi SAP Expert
    We have different SAP landscape  in our company on Oracle DB
    Due to High Oracle Licensing cost we are planning to migrate our Database to DB2 to reduce license cost
    I would like to know how Reliable DB2 is for SAP? What is % of SAP installation on DB2 worldwide
    Also will there be challenge migrating DB from Oracle to DB2
    I would appreciate if you can provide guidance on the question
    Thanks in advace
    Thanks
    Deelip

    > I would like to know how Reliable DB2 is for SAP? What is % of SAP installation on DB2 worldwide
    DB2 was and is used on quite a number of internal SAP systems that create support packages (if you check the import logs of the support packages and search for "source system).
    SAP doesn't give any exact numbers of installations compared to other databases, they did that in the past.
    > Also will there be challenge migrating DB from Oracle to DB2
    As with every database migration you'll have to check your custom programs and secondary indexes, backup strategies and methods and such.
    > I would appreciate if you can provide guidance on the question
    Be aware of the fact that you must have a certified migration consultant doing the migration on-site, otherwise SAP will deny OSS support and bill (see http://service.sap.com/osdbmigration).
    Markus

  • Null values from DB2 cause problems

    Hi,
    I have another problem with database link to DB2 using IBM iSeries Access for Linux on 64 bit OEL5 with Oracle Database gateway and unixODBC 2.2.14.
    DB link works. However, null values from DB2 cause problems. Date columns that are null on db2 return a date '30.11.0002', and character columns that are null return an error ORA-28528: Heterogeneous Services datatype conversion error.
    isql returns correct results.
    How can i fix this? Perhaps set some parameters for data conversion on the gateway?
    Thank you.

    If the driver is not fully ODBC level 3 compliant and misses functions, we're lost. But sometimes the drivers are ODBC level 3 compliant but miss the correct 64bit implementation. In those cases we can tell the gateway to use the 32bit ODBC level 3 standard by setting in the gateway init file:
    HS_FDS_SQLLEN_INTERPRETATION=32

  • Error importing a table from DB2 in OBI 10g

    Hello,
    I am trying to import a table from DB2, but I have the following issue:
    *[nQSError: 16001] ODBC error state: S1000 code: 29986 message: [IBM][Controlador ODBC de iSeries Access][DB2 UDB]SQL0901 - Error del sistema SQL..*
    Steps I have done are:
    1) Create System DSN
    Driver: iSeries Access ODBC Driver
    2) Create a new database
    Database souce definition = Database DB2/AS400
    3) Create a new connection pool -->
    Call interface: DB2 CLI (Unicode)
    Datasource name: System name (specified in the System DSN)
    I have tested with System DSN name too
    Username: username DB
    Password: pwd DB
    c) Import table: File --> Import --> from Database
    Connection Type = ODBC 3.5 and I select the System DSN created
    I am working with OBI 10g (10.1.3.2.1) in Windows Server 2003 Enterprise and the DB2 is OS400 V5R4.
    Thank you and regards,
    Mónica.

    Hi,
    I have installed the DB2 client and from Access with the same ODBC is possible to import tables, but I don't understand why I can't do this operation from Administration Tool.
    Do you know how can I test the ODBC? Or if it is possible to see the error with more details (any log file)? I have tested a lot of things, but I can't solve the issue.
    The PATH system variable is right:
    D:\oracle\bise1\bi\server\Bin;D:\oracle\bise1\bi\web\bin;D:\oracle\bise1\bi\web\catalogmanager;D:\oracle\bise1\bi\SQLAnywhere;D:\oracle\bise1\jdk\bin;D:\oracle\bise1\db\bin;D:\oracle\bise1\owb\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\TOOLS;C:\PROGRA~1\IBM\CLIENT~1\Shared;C:\PROGRA~1\IBM\CLIENT~1;C:\PROGRA~1\IBM\CLIENT~1\Emulator;
    And in the path that it is mentioned in the error I can find the dll.
    Are being doing any wrong step to import a table?
    Thank you and regards,
    Mónica.

Maybe you are looking for

  • I have two apple id's how can i convert them two one

    I have 2 apple id. How can i convert to one?

  • JDBC sender -Login Failed

    Hi I am trying to connect to SQl server 2005 database ..Getting with login failed for user... JDBC connection paramteres in lieu with the SQL version com.microsoft.sqlserver.jdbc.SQLServerDriver jdbc:sqlserver://<ip>:1433;DatabaseName=XXXX 1.I can se

  • Can we rename Ant build.xml?

    Hi Can we rename ant default build.xml name to any other name like myapp_build.xml? I know this is not right forum;I alreday googled for this.But no luck. Please help me. Thanks Anil

  • How do you convert MP4 to MP3 in Garage Band?

    I downloaded an MP4 and loaded it into GarageBand, but after I added a new track to accompany the MP4 track, GB will not record on the new track...?

  • Adobe CS2 asking for "personalization" after using it for 3+ years

    I have contacted Adobe directly about this and I saw on their site CS4 users had same issue: it asks for the serial number it is is not recognized as valid. I have the original box the discs it came with. I've gone the gamit with Adobe's recommendati