Converting ntext datatype of MS SQL to LOB datatype of Oracle using ODI

Hi
Could anyone help me how I can convert ntext datatype of MS SQL to BLOB/CLOB datatype of ORACLE using ODI tool? I have tried and it seems that ODI couldn't able to create working table with datatype of LOB.
Thank you in advance.
Myat

Try using the Incremental Update (PL/SQL) IKM. I believe this will only handle 1 CLOB column in any interface - also pay attention to the KM notes for additional constraints and requirements.
Make your staging area the same as the target.
Use the TO_CLOB function to convert the data for your field, and execute this on the target.

Similar Messages

  • Import Oracle DataBase dump file Into Sql Server With out connection oracle using c# code.

    Hi All,
    I would like to ask how can imports my dump oracle database file data and struct into sql server 2005
    with out make connection oracle.
    best regards.
    Hakim. 

    Hi Hakim.
    Based on your title, what I understood there is a issue regarding transfer oracle db dump to sql database using C# code. Am I right? If so, I am afraid there is no build-in method which meet your requrements in .NET framework. You must provides
    OraDump  Export API to allow developers integrate corresponding capabilities  into their applications. These capabilities are about export data from  Oracle dump files into popular databases like Microsoft SQL server. Every developer
    having OraDump Export API can write just few lines of code on C# or  Visual Basic to implement the appropriate export process.
    I am search a third-party link, but it's a paid service. 
    http://www.convert-in.com/data-migration-service.htm
    If you don't have to with code, Please refer to: Migrating Oracle Databases to SQL Server 2000
    http://technet.microsoft.com/en-us/library/cc966513.aspx
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Migrating SQL Server 6.5 to Oracle 8

    Hi,
    I am currently converting some stored procedures from SQL Server 6.5 to Oracle 8 (PL/SQL). I am having trouble converting some nested sql statements such as the following to work in Oracle.
    Example :
    SELECT antall=COUNT(*), ulest=(SELECT ulest=COUNT(*) FROM soknad s, annonse
    a WHERE a.kundeid=13817 AND s.annonseid=a.id and lest != '1') FROM soknad s,
    annonse a WHERE a.kundeid=13817 AND s.annonseid=a.id
    The Select is first getting a count on the two tables for a particular id, the second field in the statement has a nested select which does a similar count but has a further condition on it.
    It could be done using two SELECT statements like this -
    SELECT COUNT(*) AS antall
    FROM soknad s, annonse a
    WHERE a.kundeid = 13817
    AND s.annonseid = a.id
    SELECT COUNT(*)
    FROM soknad s, annonse a
    WHERE a.kundeid=13817
    AND s.annonseid=a.id
    AND lest != '1'
    which may be workable but I would like to keep it as similar to the original as much as possible.
    Any ideas would be great!
    Thanks,
    Brad

    I have since found out subqueries in the select list are not supported by Oracle.
    Brad
    null

  • PRO*C에서 EMBEDDED SQL STATEMENTS를 사용해서 LOB DATATYPES에 접근하는 예제

    제품 : PRECOMPILERS
    작성날짜 : 2001-07-12
    PRO*C에서 EMBEDDED SQL STATEMENTS를 사용해서 LOB DATATYPES에 접근하는 예제
    ==========================================================================
    Pro*C에서 LOB를 사용하는 방법에는 다음 3가지가 있습니다.
    (1) PL/SQL blocks에서 DBMS_LOB package를 이용하는 방법
    (2) OCI function을 이용하는 방법
    (3) Embedded SQL statements을 이용하는 방법
    다음은 (3)번째 방법에 대한 pro*c에서 지원하는 명령어들입니다.
    o APPEND: Appends lob value at the end of another LOB.
    EXEC SQL LOB APPEND :src TO :dst;
    o ASSIGN: Assigns LOB or BFILE locator to another.
    EXEC SQL LOB ASSIGN :src TO :dst;
    o CLOSE: Close LOB or BFILE.
    EXEC SQL LOB CLOSE :src;
    o COPY: Copy all or part of LOB value into another LOB.
    EXEC SQL LOB COPY :amt FROM :src [AT :src_offset] TO :dst [AT dst_offset];
    o CREATE TEMPORARY: Creates a temporary LOB.
    EXEC SQL LOB CREATE TEMPORARY :src;
    o ERASE: Erase the given amount of LOB data starting from a given offset.
    EXEC SQL LOB ERASE :amt FROM :src [AT :src_offset];
    o FILE CLOSE ALL: Closes all the BFILES open in the current session.
    EXEC SQL LOB FILE CLOSE ALL;
    o FILE SET: Set DIRECTORY alias and FILENAME in a BFILE locator.
    EXEC SQL LOB FILE SET :file DIRECTORY = :alias, FILENAME = :filename;
    o FREE TEMPORARY: Free the temporary space for the LOB locator.
    EXEC SQL LOB FREE TEMPORARY :src
    o LOAD FROM FILE: Copy all or part of BFIL into an internal LOB.
    EXEC SQL LOB LOAD :amt FROM FILE :file [AT :src_offset]
    INTO :dst [AT :dst_offset];
    o OPEN: Open a LOB or BFILE for read or read/write.
    EXEC SQL LOB OPEN :src [ READ ONLY | READ WRITE ];
    o READ: Reads all or part of LOB or BFILE into a buffer.
    EXEC SQL LOB READ :amt FROM :src [AT :src_offset]
    INTO :buffer [WITH LENGTH :buffer];
    o TRIM: Truncates the LOB vlaue.
    EXEC SQL LOB TRIM :src to :newlen;
    o WRITE: Writes contents of the buffer to a LOB.
    EXEC SQL LOB WRITE [APPEND] [FIRST | NEXT | LAST | ONE ]
    :amt FROM :buffer [WITH LENGTH :buflen] INTO :dst [AT :dst_offset];
    o DESCRIBE: Retrieves the attributes from a LOB.
    EXEC SQL LOB DESCRIBE :src GET attribute1 [{, attributeN}]
    INTO :hv1 [[INDICATOR] :hv_ind1] [{, :hvN [[INDICATOR] :hv_indN] }];
    Attributes can be any of the following:
    CHUNKSIZE: chunk size used to store the LOB value
    DIRECTORY: name of the DIRECTORY alias for BFILE
    FILEEXISTS: whether BFILE exists or not
    FILENAME: BFILE name
    ISOPEN: whether BFILE with this locate is OPEN or not
    ISTEMPORARY: whether specified LOB is temporary or not
    LENGTH: Length of BLOBs and BFILE in bytes, CLOBs and NCLOBs
    in characters.
    다음은 LOB를 사용하는 sample을 실행하는 방법입니다.
    1. 먼저 scott user에서 다음을 실행합니다. (create directory를 할 수 있는 권한이
    있어야 하며, directory는 사용하시는 환경에 맞도록 수정해 주십시요.)
    drop table lob_table;
    create table lob_table (key number, a_blob BLOB, a_clob CLOB);
    drop table lobdemo;
    create table lobdemo (key number, a_blob BLOB, a_bfile BFILE);
    drop directory dir_alias;
    create directory dir_alias as '/users/app/oracle/product/8.1.7/precomp/demo/proc';
    insert into lob_table values(1, utl_raw.cast_to_raw('1111111111'), 'aaaaaaaa');
    commit;
    2. 다음 코드는 out.gif 파일을 위에서 지정한 directory에 만들고 lob_table의
    내용에 들어있는 BLOB의 내용을 저장하는 sample입니다.
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <sqlda.h>
    #include <sqlcpr.h>
    /* Define constants for VARCHAR lengths. */
    #define UNAME_LEN 20
    #define PWD_LEN 40
    /* Declare variables. No declare section is
    needed if MODE=ORACLE. */
    VARCHAR username[UNAME_LEN]; /* VARCHAR is an Oracle-supplied struct */
    varchar password[PWD_LEN]; /* varchar can be in lower case also. */
    /* The following 3 lines avoid inclusion of oci.h during precompilation
    oci.h is needed only during compilation to resolve calls generated by
    the precompiler
    #ifndef ORA_PROC
    #include <oci.h>
    #endif
    #include <sqlca.h>
    OCIBlobLocator *blob;
    OCIClobLocator *clob;
    FILE *fp;
    unsigned int amt, offset = 1;
    #define MAXBUFLEN 5000
    unsigned char buffer[MAXBUFLEN];
    EXEC SQL VAR buffer IS RAW(MAXBUFLEN);
    /* Declare error handling function. */
    void sql_error(msg)
    char *msg;
    char err_msg[128];
    size_t buf_len, msg_len;
    EXEC SQL WHENEVER SQLERROR CONTINUE;
    printf("\n%s\n", msg);
    buf_len = sizeof (err_msg);
    sqlglm(err_msg, &buf_len, &msg_len);
    printf("%.*s\n", msg_len, err_msg);
    EXEC SQL ROLLBACK RELEASE;
    exit(EXIT_FAILURE);
    void main()
    /* Connect to ORACLE--
    * Copy the username into the VARCHAR.
    strncpy((char *) username.arr, "SCOTT", UNAME_LEN);
    /* Set the length component of the VARCHAR. */
    username.len =
    (unsigned short) strlen((char *) username.arr);
    /* Copy the password. */
    strncpy((char *) password.arr, "TIGER", PWD_LEN);
    password.len =
    (unsigned short) strlen((char *) password.arr);
    /* Register sql_error() as the error handler. */
    EXEC SQL WHENEVER SQLERROR DO sql_error("ORACLE error--\n");
    /* Connect to ORACLE. Program will call sql_error()
    * if an error occurs when connecting to the default database.
    EXEC SQL CONNECT :username IDENTIFIED BY :password;
    printf("\nConnected to ORACLE as user: %s\n", username.arr);
    /* Allocate the LOB host variables and select the BLOB value */
    EXEC SQL ALLOCATE :blob;
    EXEC SQL ALLOCATE :clob;
    EXEC SQL SELECT a_blob INTO :blob FROM lob_table WHERE key=1;
    /* Open external file to which BLOB value should be written */
    fp = fopen("out.gif", "w");
    EXEC SQL WHENEVER NOT FOUND GOTO end_of_lob;
    amt = 5000;
    EXEC SQL LOB READ :amt FROM :blob AT :offset INTO :buffer;
    fwrite(buffer, MAXBUFLEN, 1, fp);
    EXEC SQL WHENEVER NOT FOUND DO break;
    /* Use polling method to continue reading the next pieces */
    while (TRUE)
    EXEC SQL LOB READ :amt FROM :blob INTO :buffer;
    fwrite(buffer, MAXBUFLEN, 1, fp);
    end_of_lob:
    fwrite(buffer, amt, 1, fp);
    printf("\nG'day.\n\n\n");
    /* Disconnect from ORACLE. */
    EXEC SQL ROLLBACK WORK RELEASE;
    exit(EXIT_SUCCESS);
    3. 다음 코드는 위에서 만든 out.gif file을 lobdemo에 저장하는 sample입니다.
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <sqlda.h>
    #include <sqlcpr.h>
    /* Define constants for VARCHAR lengths. */
    #define UNAME_LEN 20
    #define PWD_LEN 40
    /* Declare variables. No declare section is
    needed if MODE=ORACLE. */
    VARCHAR username[UNAME_LEN]; /* VARCHAR is an Oracle-supplied struct */
    varchar password[PWD_LEN]; /* varchar can be in lower case also. */
    /* The following 3 lines avoid inclusion of oci.h during precompilation
    oci.h is needed only during compilation to resolve call generated by
    the precompiler
    #ifndef ORA_PROC
    #include <oci.h>
    #endif
    #include <sqlca.h>
    OCIBlobLocator *blob;
    OCIBFileLocator *bfile;
    char *alias = "DIR_ALIAS";
    char *filename = "out.gif";
    unsigned int amt = 50;
    unsigned int filelen;
    /* Declare error handling function. */
    void sql_error(msg)
    char *msg;
    char err_msg[128];
    size_t buf_len, msg_len;
    EXEC SQL WHENEVER SQLERROR CONTINUE;
    printf("\n%s\n", msg);
    buf_len = sizeof (err_msg);
    sqlglm(err_msg, &buf_len, &msg_len);
    printf("%.*s\n", msg_len, err_msg);
    EXEC SQL ROLLBACK RELEASE;
    exit(EXIT_FAILURE);
    void main()
    /* Connect to ORACLE--
    * Copy the username into the VARCHAR.
    strncpy((char *) username.arr, "SCOTT", UNAME_LEN);
    /* Set the length component of the VARCHAR. */
    username.len =
    (unsigned short) strlen((char *) username.arr);
    /* Copy the password. */
    strncpy((char *) password.arr, "TIGER", PWD_LEN);
    password.len =
    (unsigned short) strlen((char *) password.arr);
    /* Register sql_error() as the error handler. */
    EXEC SQL WHENEVER SQLERROR DO sql_error("ORACLE error--\n");
    /* Connect to ORACLE. Program will call sql_error()
    * if an error occurs when connecting to the default database.
    EXEC SQL CONNECT :username IDENTIFIED BY :password;
    printf("\nConnected to ORACLE as user: %s\n", username.arr);
    /* Allocate the LOB locator */
    EXEC SQL ALLOCATE :blob;
    EXEC SQL ALLOCATE :bfile;
    /* Initialize the DIRECTORY alias of the BFILE and FILENAME */
    EXEC SQL LOB FILE SET :bfile
    DIRECTORY = :alias, FILENAME = :filename;
    EXEC SQL INSERT INTO lobdemo values (1, EMPTY_BLOB(), :bfile);
    EXEC SQL SELECT a_blob, a_bfile INTO :blob, :bfile FROM lobdemo
    WHERE key = 1;
    EXEC SQL LOB OPEN :bfile;
    /* Get the BFILE length */
    EXEC SQL LOB DESCRIBE :bfile
    GET LENGTH INTO :filelen;
    printf("File length is: %d\n", filelen);
    amt = filelen;
    /* Read BFILE and write to BLOB */
    EXEC SQL LOB LOAD :amt FROM FILE :bfile INTO :blob;
    EXEC SQL LOB CLOSE :bfile;
    printf("\nG'day.\n\n\n");
    /* Disconnect from ORACLE. */
    EXEC SQL COMMIT WORK RELEASE;
    exit(EXIT_SUCCESS);
    4. 다음은 실행한 결과 입니다.
    첫번째 sample :
    Connected to ORACLE as user: SCOTT
    G'day.
    두번째 sample :
    Connected to ORACLE as user: SCOTT
    File length is: 10
    G'day.

  • Error converting SQL Server text field to Oracle CLOB

    I am trying to convert an SQL Server DB to Oracle DB using DB link. The issue I am facing is one of the SQL Server table contains text field and we are trying to convert the text field to CLOB.
    The error I am getting is "SQL Error: ORA-00997: illegal use of LONG datatype"
    The statement is something like this.
    Insert into oracle_table
    Select col_1,col_2,col_3,col_4,col_5 from sql_table@sqldblink;
    Please help.

    Hi,
      This is a known restriction involving long columns -
    (1) LONG datatype not supported with use of DBLINK when insert or update involves a select statement
    (2) LONG datatype cannot be used in a WHERE clause, in INSERT into ... SELECT ... FROM
    constructs, and in snapshots.
    The workround is to use a PL/SQL procedure or try the SQLPLUS COPY command.
    If you have access to My Oracle Support then review these notes -
    Cannot Move A Long From non Oracle database Ora-00997: Illegal Use Of Long Datatype (Doc ID 1246594.1)
    How To Workaround Error: Ora-00997: Illegal Use Of Long Datatype (Doc ID 361716.1)
    Regards,
    Mike

  • To convert the "IBM DB2 Store Procs written in C" to Oracle PL-SQL

    Hi, Is it possible to convert the "IBM DB2 Store Procs written in C" to Oracle PL-SQL. If you have any info, PL do let me know. Thanks in advance.
    EG :
    /* SMG Stored Procedures */
    /* DB2 Stored Procedure: OrganisationExists */
    /* Linkage: SIMPLE (no NULLs permitted) */
    /* Load module name: SMGEC00 */
    /* Purpose: DELETE FROM SSE_LOOKUP_MAP */
    /* to run. */
    /* Parameters: argvÝ1¨ short - return error code - OUT */
    /* argvÝ2¨ char - return error message - OUT */
    /* argvÝ3¨ char - BLEID - IN */
    /* Reason for edit Date Who */
    /* Initial version 09/04/03 Arockia */
    #pragma runopts(plist(os))
    #include <stdlib.h>
    #include <string.h>
    void main (int argc, char *argvݨ)                                             
    EXEC SQL INCLUDE SQLCA;
    EXEC SQL BEGIN DECLARE SECTION;
    char bleid??(12??);
    EXEC SQL END DECLARE SECTION;
    /* Set defaults for error code (argvÝ1¨) and error message (argvÝ2¨) */
    strcpy(argv??(2??)," ");
    *(int *)argv??(1??) = 0;
    strcpy(bleid,argv??(3??));
    EXEC SQL
    DELETE FROM SSE_LOOKUP_MAP
    WHERE BLEID = :bleid;
    /* Set error code to record status of last SQL command */
    *(int *)argv??(1??) = SQLCODE;
    return;

    For this program, you could do some thing like:
    SQL> CREATE TABLE sse_lookup_map(BLEID varchar2(10));
    Table created.
    SQL> CREATE or replace PROCEDURE test(p_bleid_in IN varchar2)
      2  AS
      3  BEGIN
      4  DELETE FROM sse_lookup_map
      5  WHERE BLEID = p_bleid_in;
      6  END;
      7  /
    Procedure created.
    SQL> ed
    Wrote file afiedt.buf
      1* INSERT INTO sse_lookup_map values('test1')
    SQL> /
    1 row created.
    SQL> ed
    Wrote file afiedt.buf
      1* INSERT INTO sse_lookup_map values('test2')
    SQL> /
    1 row created.
    SQL> SELECT * FROM sse_lookup_map;
    BLEID
    test1
    test2
    2 rows selected.
    SQL> EXEC test('test1')
    PL/SQL procedure successfully completed.
    SQL>  SELECT * FROM sse_lookup_map;
    BLEID
    test2
    1 row selected.
    SQL>

  • Equivalent datatype in Oracle for datetime of SQL Server

    Hello Everyone,
    I'm very much new to Oracle. I have been working with SQL Server since 3yrs. Currently I'm working with Oracle 11g.
    What is the equivalent datatype in oracle for datetime in sql server with which has the format YYYY-MM-DD HH:MM:SS?
    I tried with timestamp and date which didnt solve my prob.... Please help me in using the equivalent datatype for the format provided above...
    Regards,
    Bhanu Yalamanchi.

    Oracle date format can be anything you want, either by default at the session level or preferably explicitly using to_char and a format mask.
    Format masks are documented here.
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/sql_elements004.htm#CDEHIFJA
    SQL> create table t (d date);
    Table created.
    SQL> insert into t values (sysdate);
    1 row created.
    SQL> select * from t;
    D
    19-JUL-11
    SQL> alter session set nls_date_format = 'YYYY-MM-DD HH:MI:SS';
    Session altered.
    SQL> select * from t;
    D
    2011-07-19 08:27:59
    SQL> select d, to_char(d, 'YYYY-MM-DD'), to_char(d,'Day') from t;
    D                   TO_CHAR(D, TO_CHAR(D
    2011-07-19 08:27:59 2011-07-19 Tuesday
    SQL> alter session set nls_date_format = 'DD-MON-YY';
    Session altered.
    SQL> select d, to_char(d, 'YYYY-MM-DD HH24:MI:SS') from t;
    D         TO_CHAR(D,'YYYY-MM-
    19-JUL-11 2011-07-19 08:27:59

  • Convert sql form 3.0 to oracle form

    hi all
    if someone know how to convert oracle sql form 3.0 to oracle form
    best regards

    Hi Samer:
    The f45gen executable tha come with forms 4.5 can move your forms to 4.5 and then you can upgrade to forms 6i (or possibly 9i). Unfortunately I am writing this from home and I do not have Forms 4.5 her but I do have it at work. I'll sees if I can get you the correct syntax by tomorrow (if I have time). In the mean time if you have forms 4.5 you can try looking at the help for maybe f45gen or conversion, etc and you may get the syntax. Hope this helps.
    Thomas Morgan

  • Convert a String to java.sql.Date Format

    Hi,
    I am having a String of containing date in the format 'dd/mm/yyyy' OR 'dd-MMM-YYYY' OR 'mm-dd-yyyy' format. I need to convert the string to java.sql.Date object so that I can perform a query the database for the date field. Can any one suggest me with the code please.
    Regards,
    Smitha

    import java.text.SimpleDateFormat;
    import java.text.ParseException;
    import java.util.Date;
    public class TestDateFormat
         public static void main(String args[])
              SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
              System.out.println(sdf.isLenient());
              try
                   Date d1 = sdf.parse("07-11-2001");
                   System.out.println(d1);
                   Date d2 = sdf.parse("07:11:2001");
                   System.out.println(d2);
              catch(ParseException e)
                   System.out.println("Error format, " + e);
    See class DateFormat and SimpleDateFormat for detail.

  • Converting Cobol Programs to PL/SQL Packages/Procedures

    Our company is trying to move away from Cobol and code all new projects and begin to convert old code to pl/sqlpackages/procedures. I was wondering if anyone in here had any experience in converting Cobol programs to Pl/sql. Any help would be greatly appreciated.

    user8697075 wrote:
    Our company is trying to move away from Cobol and code all new projects and begin to convert old code to pl/sqlpackages/procedures.JOY!! ;-)
    I have written a lot of Cobol and converted a lot of Cobol (not to PL/SQL though). But the mere thought of it, brings a song to my heart. :D
    PL/SQL will be significantly faster and more scalable than using Cobol. It is also a lot simpler to design and code than using Cobol. Always found Cobol development very boring - except for the odd occasions when we had to design and write re-entrant Cobol code..
    Just do not make the mistake of attempting a straight port - rewriting a Cobol program essentially line by line into a PL/SQL unit. Implementing row-by-row slow-by-slow processing into PL.SQL.
    Without rethinking the process flow, the program design and so on, the resulting code unit will be little better than the original Cobol unit. Which begs the question, why bother and why use the new code then? In fact, seen this first hand back in the 80's when this approach was used to convert a pretty large system from Cobol to Natural. After many man years of development (and lots of money), the new system had all the problems of the old.. and was canned during the testing phase. Money, time and resources utterly and totally wasted.

  • How to convert rows to columns in sql server 2008

    How to convert rows to columns in sql server 2008 using the GROUP BY function? (only one query allowed)

    Lookup the Pivot transformation. From BOL:
    The Pivot transformation makes a normalized data set into a less normalized
    but more compact version by pivoting the input data on a column value. For
    example, a normalized Orders data set that lists customer name, product, and quantity purchased typically has multiple rows for any customer who purchased multiple products, with each row for that customer showing order
    details for a different product. By pivoting the data set on the product column, the Pivot transformation can output a data set with a
    single row per customer. That single row lists all the purchases by the customer, with the product names shown as column names, and the quantity shown as a value in the product column. Because not every customer purchases every product, many columns may contain
    null values.
    When a dataset is pivoted, input columns perform different roles in the pivoting process. A column can participate in the following ways:
    The column is passed through unchanged to the output. Because many input rows
    can result only in one output row, the transformation copies only the first
    input value for the column.
    The column acts as the key or part of the key that identifies a set of
    records.
    The column defines the pivot. The values in this column are associated with
    columns in the pivoted dataset.
    The column contains values that are placed in the columns that the pivot
    creates.
    Paul

  • Converting SQL Server Stored Procedure to Oracle

    Hi there,
    I tried to use SwisSQL to convert my SQL Server stored procedure to Orcale without much success.
    Is there anyone who could help me out with this?
    My SQL Server Stored Procedure is:
    CREATE PROCEDURE [dbo].[SP_BackgroundCheckRequest]
         --MASTER Table
         @MASTER_ID int,
         @PERSONNEL_ID int = NULL,
    @DATE_OF_BIRTH datetime = NULL,
         @GENDER varchar(1) = NULL,
         @COUNTRY_OF_BIRTH varchar(3) = NULL,
    @TOWN_OF_BIRTH varchar(100) = NULL,
         @STATE_OF_BIRTH varchar(50) = NULL,
         @CHECK_CATEGORY varchar(10) = NULL,
         @CHECK_TYPE varchar(10) = NULL,
         @PRIORITY varchar(10) = NULL,
         @PRIORITY_REASON varchar(100) = NULL,
         @SCREENING_LEVEL nchar(1) = NULL,
         @POSITION nchar(50) = NULL,
         @REQUEST_SOURCE varchar(60) = NULL,
         --NAME_TYPE Table
         @NAME_TYPE varchar(5) = NULL,
         @FAMILY_NAME varchar(50) = NULL,
         @FIRST_NAME varchar(50) = NULL,
         @MIDDLE_NAME varchar(50) = NULL,
         @TITLE varchar(10) = NULL,
         @PREFFERED_NAME varchar(40) = NULL,
         @PREVIOUS_NAME varchar(140) = NULL,
         --ADDRESS_TYPE Table
         @ADDRESS_TYPE varchar(10) = NULL,
         @ADDRESS_LINE_1 varchar(30) = NULL,
         @ADDRESS_LINE_2 varchar(30) = NULL,
         @ADDRESS_LINE_3 varchar(30) = NULL,
         @COUNTRY varchar(3) = NULL,
         @SUBURB varchar(50) = NULL,
         @STATE varchar(50) = NULL,
         @POSTCODE varchar(15) = NULL,
         @START_DATE varchar(10) = NULL,
         @END_DATE varchar(10) = NULL,
         --LICENSE_TYPE Table
         @LICENSE_TYPE varchar(5) = NULL,
         @LICENSE_AGENCY varchar(15) = NULL,
         @LICENSE_NUMBER varchar(100) = NULL,
         @LICENSE_SIGHTED varchar(1) = NULL,
         --PHONE_TYPE Table
         @TELEPHONE_TYPE varchar(5) = NULL,
         @TELEPHONE_NUMBER varchar(20) = NULL,
         @MOBILE_TYPE varchar(5) = NULL,
         @MOBILE_NUMBER varchar(20) = NULL,
         @EXTENSION_TYPE varchar(5) = NULL,
         @EXTENSION_NUMBER varchar(20) = NULL,
         --PASSPORT_TYPE Table
         @PASSPORT_TYPE varchar(5) = NULL,
         @PASSPORT_NUMBER varchar(50) = NULL,
         @PASSPORT_COUNTRY varchar(3) = NULL,
         @PASSPORT_SIGHTED varchar(1) = NULL
    AS
    BEGIN TRANSACTION
    INSERT into MASTER (MASTER_ID, PERSONNEL_ID, DATE_OF_BIRTH, GENDER, COUNTRY_OF_BIRTH,
         TOWN_OF_BIRTH, STATE_OF_BIRTH, CHECK_CATEGORY, CHECK_TYPE, PRIORITY, PRIORITY_REASON,
         SCREENING_LEVEL, POSITION, REQUEST_SOURCE)
         VALUES (@MASTER_ID, @PERSONNEL_ID, @DATE_OF_BIRTH, @GENDER, @COUNTRY_OF_BIRTH,
         @TOWN_OF_BIRTH, @STATE_OF_BIRTH, @CHECK_CATEGORY, @CHECK_TYPE, @PRIORITY, @PRIORITY_REASON,
         @SCREENING_LEVEL, @POSITION, @REQUEST_SOURCE)
    IF @@ERROR <> 0
    BEGIN
         ROLLBACK
         RAISERROR ('Error inserting values into MASTER table!', 16, 1)
         RETURN
    END
    INSERT into NAME_TYPE (MASTER_ID,NAME_TYPE,FAMILY_NAME,FIRST_NAME,MIDDLE_NAME,TITLE)
         VALUES (@MASTER_ID,@NAME_TYPE,@FAMILY_NAME,@FIRST_NAME,@MIDDLE_NAME,@TITLE)
    IF @@ERROR <> 0
    BEGIN
         ROLLBACK
         RAISERROR ('Error inserting values into NAME_TYPE table!', 16, 1)
         RETURN
    END
    INSERT into ADDRESS_TYPE (MASTER_ID,TYPE,ADDRESS_LINE_1,ADDRESS_LINE_2,ADDRESS_LINE_3,
              COUNTRY,SUBURB,STATE,POSTCODE,START_DATE,END_DATE)
         VALUES (@MASTER_ID,@ADDRESS_TYPE,@ADDRESS_LINE_1,@ADDRESS_LINE_2,@ADDRESS_LINE_3,
              @COUNTRY,@SUBURB,@STATE,@POSTCODE,@START_DATE,@END_DATE)
    IF @@ERROR <> 0
    BEGIN
         ROLLBACK
         RAISERROR ('Error inserting values into ADDRESS_TYPE table!', 16, 1)
         RETURN
    END
    INSERT into LICENSE_TYPE (MASTER_ID,TYPE,AGENCY,NUMBER,SIGHTED_YN)
         VALUES (@MASTER_ID,@LICENSE_TYPE,@LICENSE_AGENCY,@LICENSE_NUMBER,@LICENSE_SIGHTED)
    IF @@ERROR <> 0
    BEGIN
         ROLLBACK
         RAISERROR ('Error inserting values into LICENSE_TYPE table!', 16, 1)
         RETURN
    END
    INSERT into PHONE_TYPE (MASTER_ID,TYPE,NUMBER)
         VALUES (@MASTER_ID,@TELEPHONE_TYPE,@TELEPHONE_NUMBER)
    IF @@ERROR <> 0
    BEGIN
         ROLLBACK
         RAISERROR ('Error inserting Telephone number into PHONE_TYPE table!', 16, 1)
         RETURN
    END
    IF ((@MOBILE_TYPE <> NULL) AND (@MOBILE_NUMBER <> NULL))
    BEGIN
         INSERT into PHONE_TYPE (MASTER_ID,TYPE,NUMBER)
              VALUES (@MASTER_ID,@MOBILE_TYPE,@MOBILE_NUMBER)
         IF @@ERROR <> 0
         BEGIN
              ROLLBACK
              RAISERROR ('Error inserting Mobile number into PHONE_TYPE table!', 16, 1)
              RETURN
         END
    END
    IF ((@EXTENSION_TYPE <> NULL) AND (@EXTENSION_NUMBER <> NULL))
    BEGIN
         INSERT into PHONE_TYPE (MASTER_ID,TYPE,NUMBER)
              VALUES (@MASTER_ID,@EXTENSION_TYPE,@EXTENSION_NUMBER)
         IF @@ERROR <> 0
         BEGIN
              ROLLBACK
              RAISERROR ('Error inserting Extension number into PHONE_TYPE table!', 16, 1)
              RETURN
         END
    END
    INSERT into PASSPORT_TYPE (MASTER_ID,NUMBER,COUNTRY,SIGHTED_YN)
         VALUES (@MASTER_ID,@PASSPORT_NUMBER,@PASSPORT_COUNTRY,@PASSPORT_SIGHTED)
    IF @@ERROR <> 0
    BEGIN
         ROLLBACK
         RAISERROR ('Error inserting values into PASSPORT_TYPE table!', 16, 1)
         RETURN
    END
    COMMIT

    First, a basic concept. That also illustrates how different Oracle is (and PL/SQL) from SQL-Server (and T-SQL).
    PL/SQL integrates two different languages. The PL language. The SQL language. It allows you to code SQL source code natively inside the PL language. The PL compiler is clever enough to do the rest - make calls to the SQL engine to create SQL cursors, bind PL variable values to bind variables in the SQL code. Etc.
    PL is a "proper" programming language. It is much like Pascal (it is based on Ada, a close family member of Pascal). It is nothing at all like T-SQL.
    Okay, now for the very basic rule for Oracle development.
    Maximize SQL. This means using the SQL language to crunch data. It is the "closest" to the data. It is designed and optimised for dealing with data. Do your data processing using SQL.
    Minimize PL/SQL. This means using the PL language not to crunch data, but to provide the conditional logic. Implement business rules. And then have the SQL language crunch the data as the data processing language.
    Attempting to directly translate T-SQL code into PL/SQL is flawed. It is like trying to make coffee with teabags. Yeah, the tea may have caffeine it, but it is not coffee.
    To do what that T-SQL script does, insert a row into a table, a typical PL/SQL equivalent will look as follows:
    create or replace procedure InsertMaster( masterRow master%rowtype ) authid definer is
    .. types and variables declared here
    begin
      -- masterRow is a record structure that matches the actual MASTER table
      .. apply business rules and validation to the data.. raising user exceptions as needed
      -- e.g. the POSITION column must be upper case
      masterRow.position := upper(masterRow.position);
      -- after the business logic and data validation we can add the row to the table
      -- (PL will make the INSERT call to the SQL engine)
      insert into master values masterRow;
    end;No commit. The caller does the business transaction. It needs to decide when to commit to maintain the integrity of the data in the database. It may need to do several more calls, before committing.
    With this approach, we can give the application schema (the caller) execute privs on this procedure. This procedure is defined with definer rights. This means it runs with the privs of owner of that procedure and MASTER table. It is trusted code. It does all the correct stuff to add a valid and checked row to the MASTER table. So we give the app schema execute privs on the procedure and no insert priv on the MASTER table.
    The only way the caller can add row to the MASTER table is via this trusted procedure of ours.
    And this is a typical approach in Oracle - using the PL/SQL (both PL language and SQL language) code to create an interface to a logical database in Oracle. Abstracting the complexities of SQL from the caller. Moving business and validation into PL. Allowing us the flexibility of modifying business and validation logic, without touching a single byte of caller/client code. Allowing us to manage and tune SQL performance without dealing with (badly designed and coded) SQL from a client - as the SQL resides in PL/SQL packages and procedures and functions.

  • Using long vs. clob datatype with Oracle 8.1.7 and interMedia

    I am trying to determine the best datatype to use for a column I
    wish to search using the interMedia contains() function. I am
    developing a 100% java application using Oracle 8.1.7 on Linux.
    I'd prefer to use the standard JDBC API's for PreparedStatement,
    and not have to use Oracle extensions if possible. I've
    discovered that there are limitations in the support for LOB's
    in Oracle's 100% java driver. The PreparedStatement methods
    like setAsciiStream() and setCharacterStream() are documented to
    have flaws that may result in the corruption of data. I have
    also noticed that socket exceptions sometimes occur when a large
    amount of data is transferred. If I use the long datatype for
    my table column, the setCharacterStream() method seems to
    transfer the data correctly. When I try to search this column
    using the interMedia contains() function, I get strange
    results. If I run my search on Oracle 8.1.6 for Windows, the
    results seem to be correct. If I run the same search on Oracle
    8.1.7 for Linux, the results are usually incorrect. The same
    searches seem to work correctly on both boxes when I change the
    column type from long to clob. Using the clob type may not be
    an option for me since the standard JDBC API's to transfer data
    into internal clob fields are broken, and I may need to stick
    with standard JDBC API's. My customer wishes to purchase a
    version of Oracle for Linux that will allow us to implement the
    search capability he requires. Any guidance would be greatly
    appreciated.

    I've finally solved it!
    I downloaded the following jre from blackdown:
    jre118_v3-glibc-2.1.3-DYNMOTIF.tar.bz2
    It's the only one that seems to work (and god, have I tried them all!)
    I've no idea what the DYNMOTIF means (apart from being something to do with Motif - but you don't have to be a linux guru to work that out ;)) - but, hell, it works.
    And after sitting in front of this machine for 3 days trying to deal with Oracle's, frankly PATHETIC install, that's so full of holes and bugs, that's all I care about..
    The one bundled with Oracle 8.1.7 doesn't work with Linux redhat 6.2EE.
    Don't oracle test their software?
    Anyway I'm happy now, and I'm leaving this in case anybody else has the same problem.
    Thanks for everyone's help.

  • How to 100% Protect PL/SQL Code By Wrapped in Oracle Database 10g R2

    Hello,
    Is Possible to 100% Protect PL/SQL Code By Wrapped in Oracle 10g R2 ?
    If it is not possible by wrap in oracle 10g R2,
    Please, let me suggest, how i will be able to 100% protect PL/SQL code in Oracle Database 10g R2.
    Because, I have lot of functions, procedures & package's in my project.
    Which is running in field filed.
    So, i have needed to protect 100%.
    Also, will i convert to al functions, procedures & package's to .pll file ?
    And .pll file to .plx file?
    Is it possible to convert .plx file to .pll file ?
    Please, let know any better solutions in this case....
    Regards
    Mehedi

    Hello,
    No, wrapping is not a 100% secure method. It could prevent your code from amateurs, but not from professional hackers. Look at the article http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/wrap.htm#BEHGBJAA
    It says: "•Wrapping is not a secure method for hiding passwords or table names.
    Wrapping a PL/SQL unit prevents most users from examining the source code, but might not stop all of them."
    Edited by: apiminov on 03.12.2012 3:23
    Edited by: apiminov on 03.12.2012 3:24

  • Migration from SQL Server 7.0 to Oracle 8.0.5

    Can we migrate from SQL Server 7.0 to Oracle 8.0.5 directly without being converted to Oracle 8i objects

    Hi,
    U can convert from sql server to Oracle 8 but u've to look after the stored procedures in mssql server. If the stored procedures contains any temporary table concepts and resultset then some manual changes are required.
    Thanx,
    Durai.
    null

Maybe you are looking for