Mapping varchar2 to nvarchar

Hello,
I'm mapping from CITYADDR (VARCHAR2(30 BYTE)) to City (nvarchar(60)) and am getting the following error:
Error in COLMAP clause. Mismatched types in column mapping (src CITYADDR [64], targ City [-9]).
My def file shows these columns as :
CITYADDR 64 30 36 0 0 1 0 30 30 0 0 0 0 0 1 0 0 0
City 64 120 242 0 0 1 0 120 120 0 0 0 0 0 1 0 0 1
What is the [-9] mean in the error? Does anyone know what I'm doing wrong?
Thanks!
Ralph

both def files are in both target and destination.
How do i know what NLS_LANG to set it too. I've googled it a bit but I'm not finding anywhere that says how I should be able tell what the appropriate setting should be.
I found this site to get my Oracle setting http://oraclespin.wordpress.com/2008/05/01/setting-nls_lang-for-oracle/:
NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252
but how would i know what to set in the replicat?
Edited by: Ralph on Apr 30, 2012 8:55 AM

Similar Messages

  • Migration from 9i to 11g Transparent Gateway results in a) ORA-12704: character set mismatch b) ORA-02070: database ... does not support SYS_OP_C2C in this context

    Migration from 9i to 11g Transparent Gateway results in a) ORA-12704: character set mismatch b) ORA-02070: database ... does not support SYS_OP_C2C in this context
    What Transparent Gateway (TG) 11g configuration steps prevent the following errors?:
    a) ORA-12704: character set mismatch
    b) ORA-02070: database <DB_link_name> does not support SYS_OP_C2C in this context
    Hints:
    The current 9i TG works with the existing views and packages.  These same db objects will not compile using the new 11g TG.
    The db objects are on an Oracle 10g database linked to an SQL Server 2008 R2 database.
    Since the 9i TG works I assume a configuration to the 11g TG will get it working same as before.  But what...
    Is is something controlled by these parameters?  (Sorry, I don't know how this stuff works.  I'm the application developer.  My DBAs setup the Transparent Gateways.):
      Parameters in the Gateway Startup Shell script:
        ORA_NLS33
        NLS_LANG
      Parameters in the initsid.ora file:
        HS_LANGUAGE
        HS_NLS_DATE_FORMAT
        HS_NLS_DATE_LANGUAGE
    I'm avoiding the known workaround to refactor the VIEWS and PACKAGES to contain CAST() statements to explicitly match the data types.  A server side fix to the 11g TG is preferred. 
    Sample code:
    a) ORA-12704: character set mismatch
       ... is caused by SQL that works with my 9i TG but not with my 11g TG.  It's a snippit from my view that won't compile:
                      select status_code                  -- Oracle VARCHAR2(30)
                      from   ora_app_interfaces
                     UNION
                      select "StatusCode" as status_code  -- SQL Server NVARCHAR(30)
                      from   SqlAppInterfaces
       Example workaround that I'm avoiding:
                      select status_code
                      from   ora_app_interfaces
                     UNION
                      select CAST("StatusCode" as VARCHAR(30)) as status_code
                      from   SqlAppInterfaces
    b) ORA-02070: database <DB_link_name> does not support SYS_OP_C2C in this context
       A line of code in the procedure that compiles correctly but fails to execute:
               -- Insert into SQL Server from Oracle
               insert into PatientMedRecNum ( 
                  "PatID",         -- SQL Server INT
                  "MedRecNum",     -- SQL Server NVARCHAR(11)
                  "Hospital")      -- SQL Server NVARCHAR(30)
               values (
                  pi_pat_id,       -- Oracle NUMBER
                  pi_med_rec_num,  -- Oracle VARCHAR2
                  pi_hospital);    -- Oracle VARCHAR2
    I'd guess the errors are caused by the TG's implicit conversion between the Oracle VARCHAR2 and the SQL Server NVARCHAR... but this works fine on the 9i TG... how do I set it up to work on the 11g TG? 
    Thanks!

    Trace of 11g TG... generating errors due to lack of automatic mapping from SQL NVARCHAR to Oracle NVARCHAR, where the previous 9g TG mapped from SQL NVARCHAR to Oracle VARCHAR2.
    Oracle Corporation --- MONDAY    SEP 22 2014 13:35:08.186
    Heterogeneous Agent Release
    11.2.0.4.0
    Oracle Corporation --- MONDAY    SEP 22 2014 13:35:08.186
    Version 11.2.0.4.0
    Entered hgogprd
    HOSGIP for "HS_FDS_TRACE_LEVEL" returned "DEBUG"
    Entered hgosdip
    setting HS_OPEN_CURSORS to default of 50
    setting HS_FDS_RECOVERY_ACCOUNT to default of "RECOVER"
    setting HS_FDS_RECOVERY_PWD to default value
    setting HS_FDS_TRANSACTION_LOG to default of HS_TRANSACTION_LOG
    setting HS_IDLE_TIMEOUT to default of 0
    setting HS_FDS_TRANSACTION_ISOLATION to default of "READ_COMMITTED"
    setting HS_NLS_NCHAR to default of "UCS2"
    setting HS_FDS_TIMESTAMP_MAPPING to default of "DATE"
    setting HS_FDS_DATE_MAPPING to default of "DATE"
    setting HS_RPC_FETCH_REBLOCKING to default of "ON"
    setting HS_FDS_FETCH_ROWS to default of "100"
    setting HS_FDS_RESULTSET_SUPPORT to default of "FALSE"
    setting HS_FDS_RSET_RETURN_ROWCOUNT to default of "FALSE"
    setting HS_FDS_PROC_IS_FUNC to default of "FALSE"
    setting HS_FDS_MAP_NCHAR to default of "TRUE"
    setting HS_NLS_DATE_FORMAT to default of "YYYY-MM-DD HH24:MI:SS"
    setting HS_FDS_REPORT_REAL_AS_DOUBLE to default of "FALSE"
    setting HS_LONG_PIECE_TRANSFER_SIZE to default of "65536"
    setting HS_SQL_HANDLE_STMT_REUSE to default of "FALSE"
    setting HS_FDS_QUERY_DRIVER to default of "FALSE"
    setting HS_FDS_SUPPORT_STATISTICS to default of "TRUE"
    setting HS_FDS_QUOTE_IDENTIFIER to default of "TRUE"
    setting HS_KEEP_REMOTE_COLUMN_SIZE to default of "OFF"
    setting HS_FDS_GRAPHIC_TO_MBCS to default of "FALSE"
    setting HS_FDS_MBCS_TO_GRAPHIC to default of "FALSE"
    setting HS_CALL_NAME_ISP to "gtw$:SQLTables;gtw$:SQLColumns;gtw$:SQLPrimaryKeys;gtw$:SQLForeignKeys;gtw$:SQLProcedures;gtw$:SQLStatistics;gtw$:SQLGetInfo"
    setting HS_FDS_DELAYED_OPEN to default of "TRUE"
    setting HS_FDS_WORKAROUNDS to default of "0"
    setting HS_FDS_ARRAY_EXEC to default of "TRUE"
    Exiting hgosdip, rc=0
    ORACLE_SID is "xxxDEV"
    Product-Info:
      Port Rls/Upd:4/0 PrdStat:0
    Agent:Oracle Database Gateway for MSSQL
    Facility:hsa
    Class:MSSQL, ClassVsn:11.2.0.4.0_0019, Instance:xxxDEV
    Exiting hgogprd, rc=0
    Entered hgoinit
    HOCXU_COMP_CSET=1
    HOCXU_DRV_CSET=178
    HOCXU_DRV_NCHAR=1000
    HOCXU_DB_CSET=178
    HS_LANGUAGE not specified
    rc=1239980 attempting to get LANG environment variable.
    HOCXU_SEM_VER=102000
    Entered hgolofn at 2014/09/22-13:35:08
    RC=-1 from HOSGIP for "PATH"
    Setting PATH to "C:\oracle\product\11.2.0\tg_2\dg4msql\driver\lib"
    Exiting hgolofn, rc=0 at 2014/09/22-13:35:08
    HOSGIP for "HS_OPEN_CURSORS" returned "50"
    HOSGIP for "HS_FDS_FETCH_ROWS" returned "100"
    HOSGIP for "HS_LONG_PIECE_TRANSFER_SIZE" returned "65536"
    HOSGIP for "HS_NLS_NUMERIC_CHARACTER" returned ".,"
    HOSGIP for "HS_KEEP_REMOTE_COLUMN_SIZE" returned "OFF"
    HOSGIP for "HS_FDS_DELAYED_OPEN" returned "TRUE"
    HOSGIP for "HS_FDS_WORKAROUNDS" returned "0"
    HOSGIP for "HS_FDS_MBCS_TO_GRAPHIC" returned "FALSE"
    HOSGIP for "HS_FDS_GRAPHIC_TO_MBCS" returned "FALSE"
    treat_SQLLEN_as_compiled = 1
    Exiting hgoinit, rc=0 at 2014/09/22-13:35:08
    Entered hgolgon at 2014/09/22-13:35:08
    reco:0, name:abaccess, tflag:0
    Entered hgosuec at 2014/09/22-13:35:08
    uencoding=UTF16
    Entered shgosuec at 2014/09/22-13:35:08
    Exiting shgosuec, rc=0 at 2014/09/22-13:35:08
    shgosuec() returned rc=0
    Exiting hgosuec, rc=0 at 2014/09/22-13:35:08
    HOSGIP for "HS_FDS_RECOVERY_ACCOUNT" returned "RECOVER"
    HOSGIP for "HS_FDS_TRANSACTION_LOG" returned "HS_TRANSACTION_LOG"
    HOSGIP for "HS_FDS_TIMESTAMP_MAPPING" returned "DATE"
    HOSGIP for "HS_FDS_DATE_MAPPING" returned "DATE"
    HOSGIP for "HS_FDS_MAP_NCHAR" returned "TRUE"
    HOSGIP for "HS_FDS_RESULTSET_SUPPORT" returned "FALSE"
    HOSGIP for "HS_FDS_RSET_RETURN_ROWCOUNT" returned "FALSE"
    HOSGIP for "HS_FDS_PROC_IS_FUNC" returned "FALSE"
    HOSGIP for "HS_FDS_REPORT_REAL_AS_DOUBLE" returned "FALSE"
    HOSGIP for "HS_FDS_DEFAULT_OWNER" returned "dbo"
    HOSGIP for "HS_SQL_HANDLE_STMT_REUSE" returned "FALSE"
    Entered hgocont at 2014/09/22-13:35:08
    HS_FDS_CONNECT_INFO = "sqlserverxxx/sqlinstancexxx/SQL_Server_2008_xxx_DEV"
    RC=-1 from HOSGIP for "HS_FDS_CONNECT_STRING"
    Entered hgogenconstr at 2014/09/22-13:35:08
    dsn: sqlserverxxx/sqlinstancexxx/SQL_Server_2008_xxx_DEV, name:xxx_admin
    optn:
    Entered hgocip at 2014/09/22-13:35:08
    dsn:sqlserverxxx/sqlinstancexxx/SQL_Server_2008_xxx_DEV
    Exiting hgocip, rc=0 at 2014/09/22-13:35:08
    Entered shgogohn at 2014/09/22-13:35:08
    ohn is 'OraGtw11g_home2'
    Exiting shgogohn, rc=0 at 2014/09/22-13:35:08
    RC=-1 from HOSGIP for "HS_FDS_ENCRYPT_SESSION"
    using 0 as default value for "HS_FDS_ENCRYPT_SESSION"
    RC=-1 from HOSGIP for "HS_FDS_VALIDATE_SERVER_CERT"
    using 1 as default value for "HS_FDS_VALIDATE_SERVER_CERT"
    Entered hgocont_OracleCsidToIANA at 2014/09/22-13:35:08
    Returning 2252
    Exiting hgocont_OracleCsidToIANA at 2014/09/22-13:35:08
    Exiting hgogenconstr, rc=0 at 2014/09/22-13:35:08
    Entered hgopoer at 2014/09/22-13:35:08
    hgopoer, line 231: got native error 5701 and sqlstate 01000; message follows...
    [Oracle][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Changed database context to 'Xxx_XXX_DEV'. {01000,NativeErr = 5701}[Oracle][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Changed language setting to us_english. {01000,NativeErr = 5703}
    Exiting hgopoer, rc=0 at 2014/09/22-13:35:08
    hgocont, line 2764: calling SqlDriverConnect got sqlstate 01000
    Entered hgolosf at 2014/09/22-13:35:08
    Exiting hgolosf, rc=0 at 2014/09/22-13:35:08
    DriverName:HGmsss23.dll, DriverVer:07.01.0093 (B0098, U0065)
    DBMS Name:Microsoft SQL Server, DBMS Version:10.00.2531
    Exiting hgocont, rc=0 at 2014/09/22-13:35:08 with error ptr FILE:hgocont.c LINE:2764 ID:SQLDriverConnect
    SQLGetInfo returns Y for SQL_CATALOG_NAME
    SQLGetInfo returns 128 for SQL_MAX_CATALOG_NAME_LEN
    Exiting hgolgon, rc=0 at 2014/09/22-13:35:08
    Entered hgoulcp at 2014/09/22-13:35:08
    Entered hgowlst at 2014/09/22-13:35:08
    Exiting hgowlst, rc=1 at 2014/09/22-13:35:08
    SQLGetInfo returns Y for SQL_PROCEDURES
    SQLGetInfo returns 0x1f for SQL_OWNER_USAGE
    TXN Capable:2, Isolation Option:0xf
    SQLGetInfo returns 128 for SQL_MAX_SCHEMA_NAME_LEN
    SQLGetInfo returns 128 for SQL_MAX_TABLE_NAME_LEN
    SQLGetInfo returns 134 for SQL_MAX_PROCEDURE_NAME_LEN
    HOSGIP returned value of "TRUE" for HS_FDS_QUOTE_IDENTIFIER
    SQLGetInfo returns " (0x22) for SQL_IDENTIFIER_QUOTE_CHAR
    13 instance capabilities will be uploaded
    capno:1992, context:0x0001ffff, add-info:        0
    capno:3042, context:0x00000000, add-info:        0, translation:"42"
    capno:3047, context:0x00000000, add-info:        0, translation:"57"
    capno:3049, context:0x00000000, add-info:        0, translation:"59"
    capno:3050, context:0x00000000, add-info:        0, translation:"60"
    capno:3066, context:0x00000000, add-info:        0
    capno:3067, context:0x00000000, add-info:        0
    capno:3068, context:0x00000000, add-info:        0
    capno:3069, context:0x00000000, add-info:        0
    capno:3500, context:0x00000001, add-info:       91, translation:"42"
      capno:3501, context:0x00000001, add-info:       93, translation:"57"
    capno:3502, context:0x00000001, add-info:      107, translation:"59"
    capno:3503, context:0x00000001, add-info:      110, translation:"60"
    Exiting hgoulcp, rc=0 at 2014/09/22-13:35:08
    Entered hgouldt at 2014/09/22-13:35:08
    NO instance DD translations were uploaded
    Exiting hgouldt, rc=0 at 2014/09/22-13:35:08
    Entered hgobegn at 2014/09/22-13:35:08
    tflag:0 , initial:1
    hoi:0x12ee18, ttid (len 32) is ...
      xxx
      xxx
    tbid (len 10) is ...
      0: 09000F00 0FAC1E00 010A [..........]
    Exiting hgobegn, rc=0 at 2014/09/22-13:35:08
    Entered hgodtab at 2014/09/22-13:35:08
    count:1
      table: XXX_INTERFACE
    Allocate hoada[0] @ 0000000005F58270
    Entered hgopcda at 2014/09/22-13:35:08
    Column:1(InterfaceID): dtype:2 (NUMERIC), prc/scl:20/0, nullbl:0, octet:0, sign:1, radix:10
    Exiting hgopcda, rc=0 at 2014/09/22-13:35:08
    Entered hgopcda at 2014/09/22-13:35:08
    Column:2(TableName): dtype:-9 (WVARCHAR), prc/scl:30/0, nullbl:0, octet:60, sign:1, radix:0
    Exiting hgopcda, rc=0 at 2014/09/22-13:35:08
    Entered hgopcda at 2014/09/22-13:35:08
    Column:3(TableID): dtype:4 (INTEGER), prc/scl:10/0, nullbl:0, octet:0, sign:1, radix:10
    Exiting hgopcda, rc=0 at 2014/09/22-13:35:08
    Entered hgopcda at 2014/09/22-13:35:08
    Column:4(StatusCode): dtype:-9 (WVARCHAR), prc/scl:30/0, nullbl:0, octet:60, sign:1, radix:0
    Exiting hgopcda, rc=0 at 2014/09/22-13:35:08
    Entered hgopcda at 2014/09/22-13:35:08
    Column:5(StatusTimestamp): dtype:93 (TIMESTAMP), prc/scl:23/3, nullbl:0, octet:0, sign:1, radix:0
    Exiting hgopcda, rc=0 at 2014/09/22-13:35:08
    Entered hgopcda at 2014/09/22-13:35:08
    Column:6(InterfaceLog): dtype:-9 (WVARCHAR), prc/scl:400/0, nullbl:1, octet:800, sign:1, radix:0
    Exiting hgopcda, rc=0 at 2014/09/22-13:35:08
    The hoada for table XXX_INTERFACE follows...
    hgodtab, line 1073: Printing hoada @ 0000000005F58270
    MAX:6, ACTUAL:6, BRC:1, WHT=6 (TABLE_DESCRIBE)
    hoadaMOD bit-values found (0x40:TREAT_AS_NCHAR,0x400:UNICODE_COLUMN)
    DTY NULL-OK  LEN  MAXBUFLEN   PR/SC  CST IND MOD NAME
      3 DECIMAL N         22         22 20/  0    0   0   0 InterfaceID
    12 VARCHAR N         60         60 128/ 30 1000   0 440 TableName
      4 INTEGER N          4 4   0/  0    0   0   0 TableID
    12 VARCHAR N         60         60 128/ 30 1000   0 440 StatusCode
    91 DATE N         16         16 0/  0    0   0   0 StatusTimestamp
    12 VARCHAR Y        800        800 129/144 1000   0 440 InterfaceLog
    Exiting hgodtab, rc=0 at 2014/09/22-13:35:08
    Entered hgodafr, cursor id 0 at 2014/09/22-13:35:08
    Free hoada @ 0000000005F58270
    Exiting hgodafr, rc=0 at 2014/09/22-13:35:08
    Entered hgotcis at 2014/09/22-13:35:08
    Calling SQLStatistics for XXX_INTERFACE
    IndexType=SQL_TABLE_STAT: cardinality=0
    IndexType=1: PK_XXX_Interface
    IndexType=3: IX_TableID
    IndexType=3: IX_TableName
    Calling SQLColumns for dbo.SQL_app_INTERFACE
    #1 Column "InterfaceID": dtype=2, colsize=20, decdig=0, char_octet_length=0, cumulative avg row len=15
    #2 Column "TableName": dtype=-9, colsize=30, decdig=0, char_octet_length=60, cumulative avg row len=60
    #3 Column "TableID": dtype=4, colsize=10, decdig=0, char_octet_length=0, cumulative avg row len=64
    #4 Column "StatusCode": dtype=-9, colsize=30, decdig=0, char_octet_length=60, cumulative avg row len=109
    #5 Column "StatusTimestamp": dtype=93, colsize=23, decdig=3, char_octet_length=0, cumulative avg row len=125
    #6 Column "InterfaceLog": dtype=-9, colsize=400, decdig=0, char_octet_length=800, cumulative avg row len=725
    3 Index(es) found:
      Index: PK_XXX_Interface, type=1, ASCENDING, UNIQUE, cardinality=0
    #1 Column 1: InterfaceID
      Index: IX_TableID, type=3, ASCENDING, NON-UNIQUE, cardinality=0
    #1 Column 3: TableID
      Index: IX_TableName, type=3, ASCENDING, NON-UNIQUE, cardinality=0
    #1 Column 2: TableName
    Exiting hgotcis, rc=0 at 2014/09/22-13:35:08

  • PreparedStatement problem in Oracle OTD(JCAPS 5.1.3)

    Hi,
    I encountered a problem with Oracle-eway-generated PreparedStatements when trying to build a project in enterprise designer . I know that without using any prepraredstatement, my project builds fine. Below is the text on the error pop-up window:
    java.lang.NullPointerException
    at com.stc.codegen.OTDImpl.model.OTDCodeletFactory$ArtifactKey.hashCode(OTDCodeletFactory.java:136)
    at java.util.HashMap.hash(HashMap.java:261)
    at java.util.HashMap.containsKey(HashMap.java:339)
    at com.stc.codegen.OTDImpl.model.OTDCodeletFactory.getOtdFromBuisnessProcess(OTDCodeletFactory.java:207)
    at com.stc.codegen.OTDImpl.model.OTDCodeletFactory.createCodelets(OTDCodeletFactory.java:285)
    at com.stc.codegen.frameworkImpl.model.DeploymentVisitorImpl.process(DeploymentVisitorImpl.java:382)
    at com.stc.codegen.frameworkImpl.model.DeploymentVisitorImpl.process(DeploymentVisitorImpl.java:308)
    at com.stc.codegen.frameworkImpl.model.DeploymentVisitorImpl.traverseDeployment(DeploymentVisitorImpl.java:268)
    at com.stc.codegen.driver.module.DeploymentBuildAction.loadCodeGen(DeploymentBuildAction.java:923)
    at com.stc.codegen.driver.module.DeploymentBuildAction.access$1000(DeploymentBuildAction.java:174)
    at com.stc.codegen.driver.module.DeploymentBuildAction$1.run(DeploymentBuildAction.java:599)
    at org.openide.util.Task.run(Task.java:136)
    [catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:599)In order to isolate the problem, I have created a simplified project which just reads a text message and writes the message into the Oracle database with the help of a PreparedStatement. I had an error as well;
    "Oracle eway code generation error(ERROR_CODEGEN_BPEL_CODELET_GENERAL)"
    Caused by: com.stc.codegen.framwork.model.CodeGenException: Error when generating OTD code ...Exception: Invalid parameter type: Class: [TEST] Object: [Param1] Param Type: [VARCHAR].(ERROR_CODEGEN_DB)(ERROR_CREATE_OTD)I think that there is a conflict between the parameters in Oracle and the parameters in the code. Somehow, Oracle eway cannot get the parameter type from database correctly.
    Is there a solution for this? I couldn't find any patches/updates for Enterprise designer or eway. Can you point me to right direction if there is any.
    Thanks in advance,
    Mete

    Hi there,
    (I think) I have found the solution. When designing OTD, I have mapped VARCHAR2 column as CHAR. Somehow, JCAPS throws a code generation exception if the field is not mapped as a CHAR for a VARCHAR2 database column.

  • Difficulty in resolving ORA-06502: PL/SQL: numeric or value error:

    Hi
    I am having great difficulty to resolve the following error - ORA-06502: PL/SQL: numeric or value error: character string buffer too small . In my Oracle Package, I have a Function that returns a varchar(255).
    My Function is basically as follows:
    FUNCTION GetUserDept (DeptNum IN NUMBER) RETURN VARCHAR2
    IS
    deptname varchar(255);
    BEGIN
    SELECT name INTO deptname
    FROM depts
    where id = DeptNum;
    RETURN deptname
    END;
    The SQL is running correctly and returns one result, which is what I want. However, when I call the function in my .NET C# code, this is when I am seeing the error message.
    In my code, I said that the commandtype is a stored procedure, passed the parameters, and add it to to the parameters, with the return type and direction put first and executed as a scalar. The code executes, and then fails at the ExecuteScalar line, and it is at this point on my exception handler that I see the error message ORA-6502.
    This really odd, because I have two other functions that return numbers, and I have executed them in the same way, and theses works!
    I have checked my function and can't see what is wrong, and I have tried changing the return type from varchar2 to NVarchar on the return type, but this made no difference.
    This problem has really dogged me for hours and I cannot see how to resolve it.
    Can someone, please help me?

    user633278 wrote:
    This really odd, because I have two other functions that return numbers, and I have executed them in the same way, and theses works!It is that very reason that your code fails. You need to declare the return variable as a string.
    SQL?create or replace
    FUNCTION GetUserDept (DeptNum IN NUMBER) RETURN VARCHAR2
    IS
    deptname varchar(255);
    BEGIN
      RETURN 'hello world';
    END;
      2    3    4    5    6    7    8    9   10 
    Function created.
    SQL?
    SQL?
    declare
      x number;
    begin
      x := GetUserDept(100);
    end;
    SQL?  2    3    4    5    6  declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at line 4
    SQL?
    SQL?
    declare
      x varchar2(255);
    begin
      x := GetUserDept(100);
    end;
    SQL?  2    3    4    5    6 
    PL/SQL procedure successfully completed.

  • IS  XE  BETTER

    Hi,
    am wondering if express edition is preferbale to enterprise edition.
    And how can I increase the size of the space.
    Message was edited by:
    user539979

    HI,
    i think xe is good enough for little business: till
    100 people and if you're not
    usually store multimedia / big pdf on it, it can't be
    really enough.1) My accountant keeps the entire set of financial records for my company - since the company started - in less than 50MB. From that perspective, 4GB should be satisfactory.
    2) XE supports BFILEs - multimedia files that are stored externally to the database, with the database only keeping a pointer to the file. Requires some extra coding, but BFILEs basically do not impact the 4GB limitation.
    1)I think that most of all you have to think seriously at security and to the unpatched tiil next release status:
    A good paper is this: www.red-database-security.com/wp/hacking_and_hardening_oracle_XE.pdfIt's interesting to note that XE's initial release was delayed to ensure the latest set of security patches were included. While there are issues of which people should be aware (as described in the doc), it's not necessary to do the chicken-little-dance. A lot of the security issues I've seen are related to the original 10gR2 without patches.
    2)Storage: my opinion is that 4 gb for storing varchar2(and nvarchar as well) can be a lot,
    you're companies doesn't reach 100 employees and if you don't store multimedia / gib file contents.It depends on how it's used. See my comment above.
    3)Cpu / ram: However it depends always from the same factors: user logged concurrently,
    number of read / write per time unit, query apps complexity and here you have to do some
    sysstat to create a scenario that fits with your user / organization request if you reach the
    limits of cpu / ram.Properly coded SQL can run pretty well on 1 CPU.
    Improperly coded SQL can kill any number of CPUs.
    4)For me there's by the way another point regards the Development Environment language:
    i have choose last summer to start to develop with apex, and this Development environment
    can't be updated in xe (it can, but you're unsuported if you do hacks) and some techniques
    you find for the new version of apex aren't available for the XE.(General comment) Just remember that Apex is not the only interface for XE
    However nowadays we use Oracle xe instead of access 2003.Glad to hear it.

  • How to retrieve view column type?

    I know how to retrieve column names and comments from
    table all_col_comments.But I don't know retrieving view column type.If somebody know please help.

    ALL_TAB_COLUMNS
    ALL_TAB_COLUMNS describes the columns of the tables, views, and clusters accessible to the current user. To gather statistics for this view, use the SQL ANALYZE statement or the DBMS_STATS package.
    Related Views
    DBA_TAB_COLUMNS describes the columns of all tables, views, and clusters in the database.
    USER_TAB_COLUMNS describes the columns of the tables, views, and clusters owned by the current user. This view does not display the OWNER column.
    Column Datatype NULL Description
    OWNER
    VARCHAR2(30)
    NOT NULL
    Owner of the table, view, or cluster
    TABLE_NAME
    VARCHAR2(30)
    NOT NULL
    Name of the table, view, or cluster
    COLUMN_NAME
    VARCHAR2(30)
    NOT NULL
    Column name
    DATA_TYPE
    VARCHAR2(30)
    Datatype of the column
    DATA_TYPE_MOD
    VARCHAR2(3)
    Datatype modifier of the column
    DATA_TYPE_OWNER
    VARCHAR2(30)
    Owner of the datatype of the column
    DATA_LENGTH
    NUMBER
    NOT NULL
    Length of the column in bytes
    DATA_PRECISION
    NUMBER
    Decimal precision for NUMBER datatype; binary precision for FLOAT datatype, null for all other datatypes
    DATA_SCALE
    NUMBER
    Digits to right of decimal point in a number
    NULLABLE
    VARCHAR2(1)
    Specifies whether a column allows NULLs. Value is N if there is a NOT NULL constraint on the column or if the column is part of a PRIMARY KEY.
    COLUMN_ID
    NUMBER
    NOT NULL
    Sequence number of the column as created
    DEFAULT_LENGTH
    NUMBER
    Length of default value for the column
    DATA_DEFAULT
    LONG
    Default value for the column
    NUM_DISTINCT
    NUMBER
    These columns remain for backward compatibility with Oracle7. This information is now in the TAB_COL_STATISTICS views. This view now picks up these values from HIST_HEAD$ rather than COL$.
    LOW_VALUE
    RAW(32)
    HIGH_VALUE
    RAW(32)
    DENSITY
    NUMBER
    NUM_NULLS
    NUMBER
    Number of nulls in the column
    NUM_BUCKETS
    NUMBER
    The number of buckets in histogram for the column
    Note: The number of buckets in a histogram is specified in the SIZE parameter of the SQL statement ANALYZE. However, Oracle does not create a histogram with more buckets than the number of rows in the sample. Also, if the sample contains any values that are very repetitious, Oracle creates the specified number of buckets, but the value indicated by this column may be smaller because of an internal compression algorithm.
    LAST_ANALYZED
    DATE
    The date on which this column was most recently analyzed
    SAMPLE_SIZE
    The sample size used in analyzing this column
    CHARACTER_SET_NAME
    VARCHAR2(44)
    The name of the character set: CHAR_CS or NCHAR_CS
    CHAR_COL_DECL_LENGTH
    NUMBER
    The length
    GLOBAL_STATS
    VARCHAR2(3)
    For partitioned tables, indicates whether column statistics were collected for the table as a whole (YES) or were estimated from statistics on underlying partitions and subpartitions (NO).
    USER_STATS
    VARCHAR2(3)
    Were the statistics entered directly by the user?
    AVG_COL_LEN
    NUMBER
    Average length of the column (in bytes)
    CHAR_LENGTH
    NUMBER
    Displays the length of the column in characters. This value only applies to the following datatypes:
    CHAR
    VARCHAR2
    NCHAR
    NVARCHAR
    CHAR_USED
    VARCHAR2(1)
    B | C. B indicates that the column uses BYTE length semantics. C indicates that the column uses CHAR length semantics. NULL indicates the datatype is not any of the following:
    CHAR
    VARCHAR2
    NCHAR
    NVARCHAR2
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96536/ch2143.htm#1302694
    Joel P�rez

  • WebDAV, XDB and Static File

    How to..
    <OL type="1">
    <LI>Using only what XE offers out-of-box, configure XE/XDB/Listener/whatnot to display static file (e.g index.html) at the root URL: http:// localhost:8080
    <LI>NOT using IE,Create folder in XDB
    </OL>
    thanks
    <span style="font-size:11;">Sorry searched but seems like lots of little pieces of info scattered everywhere,</span

    It can be. In theory the validation that does on when it's updated should catch all bad errors. In general I approach this as follows..
    Get the document out use FTP. Make a backup copy :). Edit using you favorite XML editor. Put back in using FTP. More often than not if it's something I expect to do many times I will create a SQL statement to do the changes and use dbms_xdb.cfgget and cfgupd to do the changes. I also have an xdb_configuration package that get methods for the really common ones. Latest version of the code is shown below...
    alter session set current_schema = XDBPM
    create or replace view DATABASE_SUMMARY_10200
    as
    select d.NAME, p.VALUE "SERVICE_NAME", i.HOST_NAME, n.VALUE "DB_CHARACTERSET"
      from v$system_parameter p, v$database d, v$instance i, nls_database_parameters n
    where p.name = 'service_names'
       and n.parameter='NLS_CHARACTERSET';
    show errors
    grant select on DATABASE_SUMMARY_10200 to public
    create or replace package XDB_CONFIGURATION_10200
    AUTHID CURRENT_USER
    as
    function   getDatabaseSummary return xmltype;
    procedure  folderDatabaseSummary;
    procedure  addSchemaMapping
                   NAMESPACE varchar2,
                   ROOT_ELEMENT varchar2,
                   SCHEMA_URL varchar2
    procedure addMimeMapping
                 EXTENSION varchar2,
                 MAPPING varchar2
    procedure  addServletMapping
                   pattern varchar2,
                   servletname varchar2,
                   dispname varchar2,
                   servletclass varchar2,
                   servletschema varchar2,
                   language varchar2 := 'Java',
                   description varchar2 := '',
                   securityRole xmltype := NULL
      procedure deleteservletMapping
                  servletname varchar2
      procedure setAnonymousAccess
                  STATE varchar2
    end XDB_CONFIGURATION_10200;
    show errors
    create or replace view DATABASE_SUMMARY_XML_10200 of xmltype
    with object id
    'DATABASE_SUMMARY'
    as select XDB_CONFIGURATION_10200.getDatabaseSummary() from dual
    create or replace trigger NO_DML_OPERATIONS_ALLOWED
    instead of insert or update or delete on DATABASE_SUMMARY_XML_10200
    begin
    null;
    end;
    grant select on DATABASE_SUMMARY_XML_10200 to public
    create or replace public synonym DATABASE_SUMMARY_XML for DATA_SUMMARY_XML_10200
    create or replace package body XDB_CONFIGURATION_10200 as
    function getDatabaseSummary
    return XMLType
    as
      summary xmltype;
      dummy xmltype;
    begin
      select dbms_xdb.cfg_get()
      into dummy
      from dual;
      select xmlElement
               "Database",
               XMLAttributes
                 x.NAME as "Name",
                 extractValue(config,'/xdbconfig/sysconfig/protocolconfig/httpconfig/http-port') as "HTTP",
                 extractValue(config,'/xdbconfig/sysconfig/protocolconfig/ftpconfig/ftp-port') as "FTP"
               xmlElement
                 "Services",
                   xmlForest(SERVICE_NAME as "ServiceName")
               xmlElement
                 "NLS",
                   XMLForest(DB_CHARACTERSET as "DatabaseCharacterSet")
               xmlElement
                 "Hosts",
                   XMLForest(HOST_NAME as "HostName")
               xmlElement
                 "VersionInformation",
                 ( XMLCONCAT
                            (select XMLAGG(XMLElement
                               "ProductVersion",
                               BANNER
                            )from V$VERSION),
                            (select XMLAGG(XMLElement
                               "ProductVersion",
                               BANNER
                            ) from ALL_REGISTRY_BANNERS)
      into summary
      from DATABASE_SUMMARY_10200 x, (select dbms_xdb.cfg_get() config from dual);
      summary := xmltype(summary.getClobVal());
      return summary;
    end;
    procedure folderDatabaseSummary
    as
      resource_not_found exception;
      PRAGMA EXCEPTION_INIT( resource_not_found , -31001 );
      targetResource varchar2(256) := '/sys/databaseSummary.xml';
      result boolean;
      xmlref ref xmltype;
    begin
       begin
         dbms_xdb.deleteResource(targetResource,dbms_xdb.DELETE_FORCE);
       exception
         when resource_not_found then
           null;
       end;
       select make_ref(XDBPM.DATABASE_SUMMARY_XML_10200,'DATABASE_SUMMARY')
       into xmlref
       from dual;
       result := dbms_xdb.createResource(targetResource,xmlref);
       dbms_xdb.setAcl(targetResource,'/sys/acls/bootstrap_acl.xml');
    end;
    procedure addServletMapping (pattern varchar2,
                                 servletname varchar2,
                                 dispname varchar2,
                                 servletclass varchar2,
                                 servletschema varchar2,
                                 language varchar2 := 'Java',
                                 description varchar2 := '',
                                 securityRole xmltype := NULL
    as
      xdbconfig xmltype;
    begin
       xdbconfig := dbms_xdb.cfg_get();
       select deleteXML
                xdbconfig,
                '/xdbconfig/sysconfig/protocolconfig/httpconfig/webappconfig/servletconfig/servlet-list/servlet[servlet-name="' || servletname || '"]'
              into xdbconfig
              from dual;
       if (language = 'C') then
         select insertChildXML
                  xdbconfig,
                  '/xdbconfig/sysconfig/protocolconfig/httpconfig/webappconfig/servletconfig/servlet-list',
                  'servlet',
                  xmlElement
                    "servlet",
                    xmlAttributes('http://xmlns.oracle.com/xdb/xdbconfig.xsd' as "xmlns"),
                    xmlForest
                       servletname as "servlet-name",
                       language as "servlet-language",
                       dispname as "display-name",
                       description as "description"
                    securityRole           
           into xdbconfig
           from dual;
       else
         select insertChildXML
                  xdbconfig,
                  '/xdbconfig/sysconfig/protocolconfig/httpconfig/webappconfig/servletconfig/servlet-list',
                  'servlet',
                  xmlElement
                    "servlet",
                    xmlAttributes('http://xmlns.oracle.com/xdb/xdbconfig.xsd' as "xmlns"),
                    xmlForest
                       servletname as "servlet-name",
                       language as "servlet-language",
                       dispname as "display-name",
                       description as "description",
                       servletclass as "servlet-class",
                       servletschema as "servlet-schema"
           into xdbconfig
           from dual;
       end if;
       select deleteXML
                xdbconfig,
                '/xdbconfig/sysconfig/protocolconfig/httpconfig/webappconfig/servletconfig/servlet-mappings/servlet-mapping[servlet-name="' || servletname || '"]'
              into xdbconfig
              from dual;
       select insertChildXML
                xdbconfig,
                '/xdbconfig/sysconfig/protocolconfig/httpconfig/webappconfig/servletconfig/servlet-mappings',
                'servlet-mapping',
                xmltype
                   '<servlet-mapping xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">
                      <servlet-pattern>'||pattern||'</servlet-pattern>
                      <servlet-name>'||servletname||'</servlet-name>
                    </servlet-mapping>'
         into xdbconfig
         from dual;
      dbms_xdb.cfg_update(xdbconfig);
    end;
    procedure deleteservletMapping (servletname varchar2)
    as
      xdbconfig xmltype;
    begin
       xdbconfig := dbms_xdb.cfg_get();
       select deleteXML
                xdbconfig,
                '/xdbconfig/sysconfig/protocolconfig/httpconfig/webappconfig/servletconfig/servlet-list/servlet[servlet-name="' || servletname || '"]'
              into xdbconfig
              from dual;
       select deleteXML
                xdbconfig,
                '/xdbconfig/sysconfig/protocolconfig/httpconfig/webappconfig/servletconfig/servlet-mappings/servlet-mapping[servlet-name="' || servletname || '"]'
              into xdbconfig
              from dual;
      dbms_xdb.cfg_update(xdbconfig);
    end;
    procedure addSchemaMapping(NAMESPACE varchar2, ROOT_ELEMENT varchar2, SCHEMA_URL varchar2)
    is
      xdbConfig xmltype;
    begin
      xdbConfig := dbms_xdb.cfg_get();
      if (xdbConfig.existsNode('/xdbconfig/sysconfig/schemaLocation-mappings','xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"') = 0) then
        select insertChildXML
                     xdbConfig,
                     '/xdbconfig/sysconfig',
                     'schemaLocation-mappings',
                     xmltype('<schemaLocation-mappings xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"/>'),
                     'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"'
          into xdbConfig
          from dual;
      end if;
      if (xdbConfig.existsNode('/xdbconfig/sysconfig/schemaLocation-mappings/schemaLocation-mapping[namespace="'|| NAMESPACE ||'" and element="'|| ROOT_ELEMENT ||'"]','xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"') = 0) then
        select insertChildXML
                     xdbConfig,
                     '/xdbconfig/sysconfig/schemaLocation-mappings',
                     'schemaLocation-mapping',
                     xmltype('<schemaLocation-mapping xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"><namespace>' || NAMESPACE || '</namespace><element>' || ROOT_ELEMENT || '</element><schemaURL>'|| SCHEMA_URL ||'</schemaURL></schemaLocation-mapping>'),
                     'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"'
          into xdbConfig
          from dual;
      else
        select updateXML
                 xdbConfig,
                 '/xdbconfig/sysconfig/schemaLocation-mappings/schemaLocation-mapping[namespace="'|| NAMESPACE ||'" and element="'|| ROOT_ELEMENT ||'"]/schemaURL/text()',
                 SCHEMA_URL,
                 'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"'
          into xdbConfig
          from dual;
      end if;
      dbms_xdb.cfg_update(xdbConfig);
    end;
    procedure addMimeMapping(EXTENSION varchar2, MAPPING varchar2)
    is
      xdbConfig xmltype;
    begin
      xdbConfig := dbms_xdb.cfg_get();
      if (xdbConfig.existsNode('/xdbconfig/sysconfig/protocolconfig/common/extension-mappings/mime-mappings/mime-mapping[extension="' || EXTENSION || '"]','xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"') = 0) then
        select insertChildXML
                     xdbConfig,
                     '/xdbconfig/sysconfig/protocolconfig/common/extension-mappings/mime-mappings',
                     'mime-mapping',
                     xmltype('<mime-mapping xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">
                <extension>' || EXTENSION || '</extension>
                <mime-type>' || MAPPING   || '</mime-type>
                </mime-mapping>'),
                     'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"'
          into xdbConfig
          from dual;
      else
        select updateXML
                 xdbConfig,
                 '/xdbconfig/sysconfig/protocolconfig/common/extension-mappings/mime-mappings/mime-mapping[extension="' || EXTENSION || '"]/mime-type/text()',
                 MAPPING,
                 'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"'
          into xdbConfig
          from dual;
      end if;
      dbms_xdb.cfg_update(xdbConfig);
    end;
    procedure setAnonymousAccess(STATE varchar2)
    is
      xdbConfig xmltype;
    begin
      xdbConfig := dbms_xdb.cfg_get();
      if (xdbConfig.existsNode('/xdbconfig/sysconfig/protocolconfig/httpconfig/allow-repository-anonymous-access') = 0) then
        select insertChildXML
                     xdbConfig,
                     '/xdbconfig/sysconfig/protocolconfig/httpconfig',
                     'allow-repository-anonymous-access',
                     xmltype('<allow-repository-anonymous-access xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">' || lower(STATE) || '</allow-repository-anonymous-access>'),
                     'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"'
          into xdbConfig
          from dual;
      else
        select updateXML
                 xdbConfig,
                 '/xdbconfig/sysconfig/protocolconfig/httpconfig/allow-repository-anonymous-access/text()',
                 lower(STATE),
                 'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"'
          into xdbConfig
          from dual;
      end if;
      dbms_xdb.cfg_update(xdbConfig);
    end;
    end XDB_CONFIGURATION_10200;
    show errors
    grant execute on XDB_CONFIGURATION_10200 to public
    create or replace public synonym XDB_CONFIGURATION for XDB_CONFIGURATION_10200
    desc XDB_CONFIGURATION
    show errors
    call xdb_configuration.folderDatabaseSummary()
    set echo on
    set pages 100
    set long 10000
    select xdburitype('/sys/databaseSummary.xml').getXML() from dual
    alter session set current_schema = SYS
    /Note that some of these issues (which are non XE specific) are also discussed in the XDB forum
    XML DB

  • How to handle Universal characters ??

    Hi,
    I was using the VARCHAR2 datatype in some of the columns for all my tables in my backend. This would work perfectly as long as we enter English chars from the front end(JSP).
    But if i try to change my language settings thru Control panel, then i could type non-english chars as well. But this would throw the exception something like incovertible types,since VARCHAR2 wont be allowing non-english chars!! So, i changed VARCHAR2 to NVARCHAR..
    Will this change be impact on my front end, if i enter non-english chars??
    Please suggest me, how do i handle this situation in the front end??
    Thanks in advance

    Maybe you should ask in an Oracle forum (if your DB is Oracle).

  • How to map text(n) in access to varchar2(2n) ?

    Question 1:
    Because some asian characters count 2 bytes in oracle
    while they count only 1 character in access, I want to map
    any text column with length (N) in acccess to varchar2(2N), so that there won't be any data loss.
    I tried changing it in 'data type mapping' page of capturing wizard.
    I set 'length' of text->varchar2 mapping to 2.
    I Also tried changing Options from tools menu before creating oracle model.
    But the oracle model created wasn't affected by this setting. In oracle model, the result is still varchar2(n)instead of varchar2(2n)
    any suggestion?
    Question 2:
    So I tried to change the size of columns in oracle model.
    ( eg: change varchar2(40) to varchar2(80) )
    Partly it worked.
    The columns created in destination oracle database are 80 bytes long,
    but the data migrated was cutting off at 40, the rest was gone.
    any suggestion.
    ps.
    access 2000 -> oracle 10gR1
    omwb 10.1.0.4 ( win2000 sp4 )

    Hi, turloch
    Zfan,
    -Are you getting this problem only on text to
    varchar2?as far as i know, yes. only on text -> varchar2.
    i changed the mapping of text->varchar2 in tools->option->data type mappings
    set it to 3 then recreated the oracle model as being prompted.
    but the mapping is not correctly reflected in the resulting oracle model.
    -Does setting the target for Text to varchar2(4000)
    help? [click on the field change to 4000 then click
    on another field before clicking ok]yes. i've tried. setting it to 4000 makes all the varchar2 column 4000 bytes long.
    i also tried 100, makes all the varchar2 column 100 bytes long.
    i also tried 90, no effect.
    -Is this a general problem or a specific problem?
    i.e. Does this happen on memo to clob
    conversion...(As well as local testing here in
    Dublin, Ireland, testing is done in Japan which I
    would expect to catch most multibyte character
    issues)i don't know abt. memo-> clob. never tested it.
    but for text-> varchar2, it definitely got some problem.
    >
    The columns created in destination oracle databaseare 80 bytes long,
    but the data migrated was cutting off at 40, therest was gone.
    This sounds like a bug, is this reproducable, for a
    test case, and does it occur in other conditions?
    i can provide screen shot or test case if you want.
    can upload them info oracle files so that you can download it.
    Regards,
    Turloch
    Oracle Migration Workbench Team

  • NVARCHAR - NVARCHAR2 datatype mapping between sql server and oracle.

    Question regarding size allocation that occurs for NVARCHAR columns in sql server to NVARCHAR2 in Oracle in the migration tool.
    The migration tool has converted NVARCHAR columns to be twice their size as NVARCH2 in Oracle. Example, a table whose column is mycol NVARCHAR(40) gets migrated as mycol NVARCHAR2(80).
    In SQL Server land, the designation of a column as NVARCHAR(40) will physically store the column as 80 bytes. However, as I understand from this excerpt (taken from here: http://www.oracle.com/technology/oramag/oracle/03-nov/o63tech_glob.html), that Oracle in essence will do the same thing for NVARCHAR2:
    To make it easy to allocate proper storage for Unicode values, Oracle9i Database introduced character semantics. You can now use a declaration such as VARCHAR2(3 CHAR), and Oracle will set aside the correct number of bytes to accommodate three characters in the underlying character set. In the case of AL32UTF8, Oracle will allocate 12 bytes, because the maximum length of a UTF-8 character encoding is four bytes (3 characters * 4 bytes/character = 12 bytes). On the other hand, if you're using AL16UTF16, in which case your declaration would be NVARCHAR2(3), Oracle allocates just six bytes (3 characters * 2 bytes/character = 6 bytes). One difference worth noting is that for UTF-8, a declaration using character semantics allows enough room for surrogate characters, whereas for UTF-16 that is not the case. A declaration such as NVARCHAR2(3) provides room for three UTF-16 code units, but a single supplementary character may consume two of those code units.
    As I read this, NVARCHAR(40) in sql server should be equivalent to NVARCHAR2(40) in Oracle and not NVARCHAR2(80) as it gets translated to - am I missing something? We have a rather large database to migrate so I need to get this size allocation right (and I obviously don't want to truncate any data).
    Thanks -

    Right - well, that's what I'm suggesting is that NVARCHAR(8) in SQL Server is equivalent to NVARCHAR2(8) in Oracle. Truncation will occur after 8 of any character, including, say, double byte Kanjii characters, which would physically store 16 bytes in the NVARCHAR(8) NVARCHAR2(8) column defn. I tried that in both SQL Server and Oracle, and the behavior is the same.
    Also, technically, NVARCHAR2(8) and VARCHAR2(8 CHAR) is roughly the same in terms of behavior, except that in the first case, the physical storage is 16 bytes, while in the second case, it's 24 bytes (to account for 'supplemental' characters or true UTF-8 compliance). Same truncation occurs after 8 of -any- character be it single byte ascii or double byte kanjii, which is the behavior I expect.
    Thanks for looking into this. What I decided to do was the following:
    What was originally defined in SQL Server as varchar (and translated to VARCHAR2 with the CHAR designation), I removed the CHAR designation since I truly want that number of bytes to be stored, and not characters (for columns I do not care about UTF8 or 16 compliance - that will also mimic the same behavior I currently have on the SQL Server side. For anything that was nvarchar in SQL Server, I went ahead and created them as VARCHAR2 with the CHAR designation, with the same size (not double the value as was in SQL Server which the documentation says it gets translated to). I did this since we probably will need true UTF-8 compliance down the line, and since I had the hood open, it was easy enough to do. I could also have converted NVARCHAR(n) to NVARCHAR2(n) (and not n*2) as what was happening in the migration.
    I tested strings in both cases, and I think I have my solution.
    Edited by: kpw on Sep 24, 2008 11:21 AM

  • MS SQL to Oracle Problem:  nvarchar's being loaded as null varchar2's

    If anyone has any insight into this, I would really appreciate it.
    I'm trying to build an incredibly simple Interface that mirrors a small MS SQL Server table into and Oracle table. The source MS table is a series of int, smallint, numeric, datetime and nvarchar columns. Similiarly, I've built my Oracle target table to be comprised of corresponding number, date and varchar2 columns.
    The issue is that my Interface runs just fine, but only the date and number-related columns actually come across. All the columns that are loading nvarchar->varchar2 are simply populated with nulls.
    I can't seem to figure out what the problem that ODI is having. There are no errors during execution, and back in Designer I can even do a "View Data" on the source MS table, and can browser all the data just fine.
    Something is happening during transit and I can't figure out why. My current LKM is "LKM SQL to Oracle" though I've also tried "LKM SQL to SQL" with no luck. Clearly something is happening with the nvarchar to varchar2 conversion, but that seems like a ridiculous thing for ODI to have a problem with. Even moreso that's it not actually throwing any errors, but simply not populating them.
    Anyone have any thoughts?
    Thanks
    John

    Dev-
    Thanks for replying. And that's funny, I think you were posting your comment right as I was posting my quick additional detail one.
    Yes, I have actually already tried that. I have set the LKM to keep temporary tables so that I could check the C$_... table. And the nvarchar columns are already showing as null there. And there are no joins in this Interface at all. It is a very simple interface that mirrors a single small source table, into a clone on the Oracle side for staging purposes ( A [MSSQL] ---> B [Oracle] ).
    So, because the C$_ is already showing nulls for the columns that were nvarchar, it seems something is happening in transit while converting the nvarchar to varchar2.
    Thanks
    John

  • ORA-01461 Error when mapping table with multiple varchar2(4000) fields

    (Note: I think this was an earlier problem, supposed fixed in 11.0, but we are experiencing in 11.7)
    If I map an Oracle 9i table with multiple varchar2(4000) columns, targeting another Oracle 9i database, I get the ORA-01461 error (Can't bind a LONG value only for insert into a LONG).
    I have tried changing the target columns to varchar2(1000), as suggested as a workaround in earlier versions, all to no avail.
    I can have just one varchar2(4000) map correctly and execute flawlessly - the problem occurs when I add a second one.
    I have tried making the target column a LONG, but that does not solve the problem.
    Then, I made the target database SQL Server, and it had no problem at all, so the issue seems to be Oracle-related.

    Hi Jon,
    Thanks for the feedback. I'm unable to reproduce the problem you describe at the moment - if I try to migrate a TEXT(5), OMWB creates a VARCHAR(5) and the data migrates correctly!! However, I note from you description that even though the problematic source column datatype is TEXT(5), you mention that there are actually 20 lines of text in this field (and not 5 variable length characters as the definition might suggest).
    Having read through some of the MySQL reference guide I note that, in certain circumstances, MySQL actually changes the column datatype specified either at table creation time or when interfacing with other databases ( ref 14.2.5.1 Silent Column Specification Changes and 12.7 Using Column Types from Other Database Engines in the MySQL reference guide). Since your TEXT(5) actually contains 20 lines of text, MySQL (database or JDBC driver .... or both) may be trying to automatically map the specified datatype of the column to a datatype more appropriate to storing 20 lines of text.... that is, to a LONG value in this case. Then, when Oracle is presented with this LONG value to store in a VARCHAR(5) field, it throws the ORA-01461 error. I need to investigate this further, but this may be the case - its the first time I've see this problem encountered.
    To workaround this, you could change the datatype of the column to a LONG from within the Oracle Model before migrating. Any application code that accesses this column and expects a TEXT(5) value may need to be adjusted to cope with a LONG value. Is this a viable workaround for you?
    I will investigate further and notiofy you of any details I uncover. We will need to track this issue for possible inclusion in future development plans.
    I hope this helps,
    Regards,
    Tom.

  • Data Type Mapping from SQL server to Oracle

    I am using Oracle 12c with heterogenous services connecting to SQL server DB. Some of the columns in the SQL server SB are defined as 'nvarchar(max)'. These are coming over to Oracle as 'long' type columns. I would like these to be 'varchar2' types in Oracle so I do not have any of the restrictions related to 'long' type fields when using. I can create a view in SQlServer to convert the data type ie. nvarchar(100). What is the highest value I can use to make the data show in Oracle as varchar? BTW  I tried nvarchar(4000) but that still showed as long. I tried nvarchar(1000), and that did show as varchar.

    The maximum value for a nvarchar2 in Oracle is 2000. The mapping -if the remote column is mapped to an Oracle varchar/nvarchar- depends on the data type returned by the ODBC driver. When the driver returns SQL_Varchar, then the maximum precision is 4000 and when it will map it to SQL_WVarchar then it is 2000.
    As your Oracle database uses AL32UTF8 as character set you will get the nvarchar(max) mapped to Oracle longs as the content of your SQL Server nvarchar is stored using UCS2 character set which is covered by the Oracle database charset UTF8. So it shouldn't really matter if the returned string is mapped to an Oracle varchar or nvarchar.

  • ** How to use TO_DATE function in Stored Proc. for JDBC in ABAP-XSL mapping

    Hi friends,
    I use ABAP-XSL mapping to insert records in Oracle table. My Sender is File and receiver is JDBC. We use Oracle 10g database. All fields in table are VARCHAR2 except one field; this is having type 'DATE'.
    I use Stored procedure to update the records in table. I have converted my string into date using the Oracle TO_DATE function. But, when I use this format, it throws an error in the Receiver CC. (But, the message is processed successfully in SXMB_MONI).
    The input format I formed like below:
    <X_EMP_START_DT hasQuot="No" isInput="1" type="DATE">
    Value in Payload is like below.
    <X_EMP_START_DT hasQuot="No" isInput="1" type="DATE">TO_DATE('18-11-1991','DD-MM-YYYY')</X_EMP_START_DT>
    Error in CC comes as below:
    Error processing request in sax parser: Error when executing statement for table/stored proc. 'SP_EMP_DETAILS' (structure 'STATEMENT'): java.lang.NumberFormatException: For input string: "TO_DATE('18"
    Friends, I have tried, but unable to find the correct solution to insert.
    Kindly help me to solve this issue.
    Kind Regards,
    Jegathees P.
    (But, the same is working fine if we use direct method in ABAP-XSL ie. not thru Stored Procedure)

    Hi Sinha,
    Thanks for your reply.
    I used the syntax
    <xsl:call-template name="date:format-date">
       <xsl:with-param name="date-time" select="string" />
       <xsl:with-param name="pattern" select="string" />
    </xsl:call-template>
    in my Abap XSL.  But, its not working correctly. The problem is 'href' function to import "date.xsl" in my XSLT is not able to do that. The system throws an error. Moreover, it is not able to write the command 'extension-element-prefixes' in my <xsl:stylesheet namespace>
    May be I am not able to understand how to use this.
    Anyway, I solved this problem by handling date conversion inside Oracle Stored Procedure. Now, its working fine.
    Thank you.

  • Need to convert the Varchar2 to decimal

    Hi,
    I need to convert source sybase varchar2 record in to decimal record in Target DB2 table by using the function in Oracle data integrator.
    In my source table, column is defined as varchar2 (4) and in target table same column has defined as Decimal (2). So, is there any function to convert the varchar2 data to decimal record.
    thanks,
    keshav.

    Hi SH,
    Thanx so much for your answer!
    Well actually I have managed to do the filters, and right now dealing with the convertion of formats.
    Right now I am working with Oracle DB 11g, and Excel; and what i would like to do is now that is passing from my uploaded excel the info to my Oracle DB would like to control the ways it pases the info.
    Let's say for example, that I have gotten a Field A in my source table (Excel uploaded to ODI), and that on my Orazle Table on Field A i would like to change the data type of the field, or just make sure that the data inserted will always be of certain type? Can I do this with ODI? Could you please give me some advice in how to it? I assume that it should be done on my interface, in the Diagram tab > Target Database > Mapping Area > Implementation Tab > Expression Editor and modify it there, is it?
    As this is mapping from excel, can I just use the excel function? it does not make any sense for me as it is all in Oracle. I am sorry but I am kinda confused now.
    Once again I do really appreciate your help.

Maybe you are looking for

  • Final Cut won't open for a project

    I can open Final cut Pro HD But I cannot open my project After adding 10 Livetype titles. Every time I try to open the project the application crashes at 13% of reading the project. I can open other projects but not this one. The Project is only 30 m

  • Business area not reflected in MIRO additional details

    Hi all, There is problem regarding business area in MIRO, in follow on documents business area is not getting reflected for all the line items. Please see where the problem is, I have checked OMJ7 and business area is there for all Plant/Valuation ar

  • How do I browse directory contents in Contribute CS3?

    Hi everyone! I have one of our users uploading photos to our website.  At the moment she uses an FTP connection via Adobe Contribute CS3 to our web server.  This has worked great in the past.  However, at the moment she's uploading pictures to a dyna

  • Bar code reader problem

    when i try to install "bar code reader" in my nokia n73; i got 'Unable to install - component is built in' plz help........

  • Flip video on iweb?

    Can you put video blogs from a flip video on iWEB? much obliged. create an incredible day. JT