Inserting into Postgres via ODBC Gateway

Hi, I've made some tests, here are results and questions:
Postgres:
CREATE TABLE t_dump
  str character varying(100)
)Oracle: [ORADB: db link to Postgrers]
INSERT INTO "t_dump"@ORADB VALUES ('test'); Works fine, both from SQL as from PL/SQL
However:
Declare
m_str Varchar2 (10) := 'test';
Begin
INSERT INTO "t_dump"@ORADB VALUES (m_str); 
End;Gives me an error:
Error report:
ORA-00604: error occurred at recursive SQL level 1
ORA-02067: transaction or savepoint rollback required
ORA-28511: lost RPC connection to heterogeneous remote agent using SID=ORA-28511: lost RPC connection to heterogeneous remote agent using SID=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=DB)(PORT=1521))(CONNECT_DATA=(SID=pg)))
ORA-02055: distributed update operation failed; rollback required
ORA-02063: preceding lines from ORADB
ORA-06512: at line 8
00604. 00000 -  "error occurred at recursive SQL level %s"
*Cause:    An error occurred while processing a recursive SQL statement
           (a statement applying to internal dictionary tables).
*Action:   If the situation described in the next error on the stack
           can be corrected, do so; otherwise contact Oracle Support.Dynamic SQL gives exact same error:
Declare
m_str Varchar2 (10) := 'test';
Begin
EXECUTE IMMEDIATE
'INSERT INTO "t_dump"@ORADB VALUES (:v0)'
  Using m_str;
End;Is there any way I could use variables into queries?
One more issiue:
I have created partitioned table in Postgres, and simple INSERT statement works fine [SQL from Oracle]; however- the same statement, enclosed with begin/end [PL/SQL] needs about 60 seconds to finish. Is it normal behaviour? Is there any config/pragma/.. I could use to speed it up?
Regards
Bart Dabr

Hi,
Your sample also doesn't work in PL/SQL block..
Here is my detailed config:
Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
TNS for Linux: Version 11.2.0.1.0 - Production
PostgreSQL 8.4.8 on x86_64-pc-linux-gnu, compiled by GCC gcc-4.5.real (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2, 64-bit
and latest ODBC version from Postgres webpage (09.00.0310)
I will install the latest Postgres DB and try it then
Here is the trace, with removed some 'libname=/usr/lib64/libodbc.so, funcname=SQLGetDescRec' parts from init
Oracle Corporation --- WEDNESDAY OCT 05 2011 10:00:47.743
Heterogeneous Agent Release
11.2.0.1.0
Oracle Corporation --- WEDNESDAY OCT 05 2011 10:00:47.743
    Version 11.2.0.1.0
Entered hgogprd
HOSGIP for "HS_FDS_TRACE_LEVEL" returned "255"
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 "AL32UTF8"
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_CHARACTER_SEMANTICS 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 "TRUE"
setting HS_FDS_SUPPORT_STATISTICS to default of "FALSE"
Parameter HS_FDS_QUOTE_IDENTIFIER is not set
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"
HOSGIP returned value of "32" for HS_FDS_SQLLEN_INTERPRETATION
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"
Exiting hgosdip, rc=0
ORACLE_SID is "pg"
Product-Info:
  Port Rls/Upd:1/0 PrdStat:0
  Agent:Oracle Database Gateway for ODBC
  Facility:hsa
  Class:ODBC, ClassVsn:11.2.0.1.0_0008, Instance:pg
Exiting hgogprd, rc=0
hostmstr:          0:      HOA After hoagprd
hostmstr:          0:      HOA Before hoainit
Entered hgoinit
HOCXU_COMP_CSET=1
HOCXU_DRV_CSET=870
HOCXU_DRV_NCHAR=873
HOCXU_DB_CSET=873
HOCXU_SEM_VER=112000
Entered hgolofn at 2011/10/05-10:00:47
HOSGIP for "HS_FDS_SHAREABLE_NAME" returned "/usr/lib64/libodbc.so"
Entered hgolofns at 2011/10/05-10:00:47
libname=/usr/lib64/libodbc.so, funcname=SQLAllocHandle
symbol_peflctx=0xe74082a0
hoaerr:0
Exiting hgolofns at 2011/10/05-10:00:47
Entered hgolofns at 2011/10/05-10:00:47
Exiting hgolofns at 2011/10/05-10:00:47
Exiting hgolofn, rc=0 at 2011/10/05-10:00:47
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 = 0
Exiting hgoinit, rc=0 at 2011/10/05-10:00:47
hostmstr:          0:      HOA After hoainit
hostmstr:          0:      HOA Before hoalgon
Entered hgolgon at 2011/10/05-10:00:47
reco:0, name:kg, tflag:0
Entered hgosuec at 2011/10/05-10:00:47
Exiting hgosuec, rc=0 at 2011/10/05-10:00:47
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_CHARACTER_SEMANTICS" returned "FALSE"
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"
using kg as default value for "HS_FDS_DEFAULT_OWNER"
HOSGIP for "HS_SQL_HANDLE_STMT_REUSE" returned "FALSE"
Entered hgocont at 2011/10/05-10:00:47
HS_FDS_CONNECT_INFO = "pg"
RC=-1 from HOSGIP for "HS_FDS_CONNECT_STRING"
Entered hgogenconstr at 2011/10/05-10:00:47
dsn:pg, name:kg
optn:
Entered hgocip at 2011/10/05-10:00:47
dsn:pg
Exiting hgocip, rc=0 at 2011/10/05-10:00:47
##>Connect Parameters (len=22)<##
## DSN=pg;
#! UID=kg;
#! PWD=*
Exiting hgogenconstr, rc=0 at 2011/10/05-10:00:47
Entered hgolosf at 2011/10/05-10:00:47
ODBC Function-Available-Array 0xFFFE 0x01FF 0xFF00 0xFA7F 0x03FF 0x0000
                              0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
                              0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
                              0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
                              0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
                              0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
                              0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
                              0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
                              0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
                              0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
                              0x0000 0x0000 0xFE00 0x3B5D
Exiting hgolosf, rc=0 at 2011/10/05-10:00:47
DriverName:psqlodbcw.so, DriverVer:09.00.0310
DBMS Name:PostgreSQL, DBMS Version:8.4.8
Exiting hgocont, rc=0 at 2011/10/05-10:00:47
SQLGetInfo returns Y for SQL_CATALOG_NAME
SQLGetInfo returns 0 for SQL_MAX_CATALOG_NAME_LEN
Exiting hgolgon, rc=0 at 2011/10/05-10:00:47
hostmstr:          0:      HOA After hoalgon
RPC Calling nscontrol(0), rc=0
hostmstr:          0: RPC Before Upload Caps
hostmstr:          0:      HOA Before hoaulcp
Entered hgoulcp at 2011/10/05-10:00:47
Entered hgowlst at 2011/10/05-10:00:47
Exiting hgowlst, rc=0 at 2011/10/05-10:00:47
SQLGetInfo returns 0x1d for SQL_OWNER_USAGE
TXN Capable:2, Isolation Option:0xa
SQLGetInfo returns 64 for SQL_MAX_SCHEMA_NAME_LEN
SQLGetInfo returns 64 for SQL_MAX_TABLE_NAME_LEN
SQLGetInfo returns 0 for SQL_MAX_PROCEDURE_NAME_LEN
SQLGetInfo returns " (0x22) for SQL_IDENTIFIER_QUOTE_CHAR
SQLGetInfo returns Y for SQL_COLUMN_ALIAS
3 instance capabilities will be uploaded
  capno:1989, context:0x00000000, add-info:        0
  capno:1991, context:0x0001ffff, add-info:        0
  capno:1992, context:0x0001ffff, add-info:        0
Exiting hgoulcp, rc=0 at 2011/10/05-10:00:47
hostmstr:          0:      HOA After hoaulcp
hostmstr:          0: RPC After Upload Caps
hostmstr:          0: RPC Before Upload DDTR
hostmstr:          0:      HOA Before hoauldt
Entered hgouldt at 2011/10/05-10:00:47
NO instance DD translations were uploaded
Exiting hgouldt, rc=0 at 2011/10/05-10:00:47
hostmstr:          0:      HOA After hoauldt
hostmstr:          0: RPC After Upload DDTR
hostmstr:          0: RPC Before Begin Trans
hostmstr:          0:      HOA Before hoabegn
Entered hgobegn at 2011/10/05-10:00:47
tflag:0 , initial:1
hoi:0x1c6766b8, ttid (len 22) is ...
  00: 53452E65 36323536 3636622E 322E3135  [SE.e625666b.2.15]
  10: 2E393235 3737                        [.92577]
                 tbid (len 19) is ...
  00: 53455B32 2E31352E 39323537 375D5B31  [SE[2.15.92577][1]
  10: 2E345D                               [.4]]
Exiting hgobegn, rc=0 at 2011/10/05-10:00:47
hostmstr:          0:      HOA After hoabegn
hostmstr:          0: RPC After Begin Trans
hostmstr:          0: RPC Before Describe Procedure
hostmstr:          0:      HOA Before hoapdsc
Entered hgopdsc at 2011/10/05-10:00:47
Describing procedure kg.test
Output hoada
hgopdsc, line 1406: NO hoada to print
Exiting hgopdsc, rc=942 at 2011/10/05-10:00:47
hostmstr:          0:      HOA After hoapdsc
hostmstr:          0: RPC After Describe Procedure
hostmstr:          0: RPC Before Describe Table
hostmstr:          0:      HOA Before hoadtab
Entered hgodtab at 2011/10/05-10:00:47
count:1
  table: kg.test
Allocate hoada[0] @ 0xdcaa10
Entered hgopcda at 2011/10/05-10:00:47
Column:1(col1): dtype:4 (INTEGER), prc/scl:10/0, nullbl:1, octet:-1, sign:1, radix:10
Exiting hgopcda, rc=0 at 2011/10/05-10:00:47
Entered hgopcda at 2011/10/05-10:00:47
Column:2(col2): dtype:12 (VARCHAR), prc/scl:100/0, nullbl:1, octet:255, sign:1, radix:10
Exiting hgopcda, rc=0 at 2011/10/05-10:00:47
The hoada for table kg.test follows...
hgodtab, line 876: Printing hoada @ 0xdcaa10
MAX:2, ACTUAL:2, BRC:1, WHT=6 (TABLE_DESCRIBE)
hoadaMOD bit-values found (0x200:TREAT_AS_CHAR)
DTY         NULL-OK  LEN  MAXBUFLEN   PR/SC  CST IND MOD NAME
  4 INTEGER Y          4          4   0/  0    0   0   0 col1
12 VARCHAR Y        255        255   0/  0    0   0  200 col2
Exiting hgodtab, rc=0 at 2011/10/05-10:00:47
hostmstr:          0:      HOA After hoadtab
hostmstr:          0:      HOA Before hoadafr
Entered hgodafr, cursor id 0 at 2011/10/05-10:00:47
Free hoada @ 0xdcaa10
Exiting hgodafr, rc=0 at 2011/10/05-10:00:47
hostmstr:          0:      HOA After hoadafr
hostmstr:          0: RPC After Describe Table
hostmstr:          0: RPC Before SQL Bundling
hostmstr:          0:      HOA Before hoxpars
Entered hgopars, cursor id 1 at 2011/10/05-10:00:47
type:0
SQL text from hgopars, id=1, len=46 ...
     00: 53454C45 43542041 312E2263 6F6C3122  [SELECT A1."col1"]
     10: 2C41312E 22636F6C 32222046 524F4D20  [,A1."col2" FROM ]
     20: 226B6722 2E227465 73742220 4131      ["kg"."test" A1]
Exiting hgopars, rc=0 at 2011/10/05-10:00:47
hostmstr:          0:      HOA After hoxpars
hostmstr:          0:      HOA Before hoxopen
Entered hgoopen, cursor id 1 at 2011/10/05-10:00:47
hgoopen, line 86: NO hoada to print
Deferred open until first fetch.
Exiting hgoopen, rc=0 at 2011/10/05-10:00:47
hostmstr:          0:      HOA After hoxopen
hostmstr:          0:      HOA Before hoxdscr
Entered hgodscr, cursor id 1 at 2011/10/05-10:00:47
Allocate hoada @ 0xdca9d0
Entered hgopcda at 2011/10/05-10:00:47
Column:1(col1): dtype:4 (INTEGER), prc/scl:10/0, nullbl:1, octet:0, sign:1, radix:0
Exiting hgopcda, rc=0 at 2011/10/05-10:00:47
Entered hgopcda at 2011/10/05-10:00:47
Column:2(col2): dtype:12 (VARCHAR), prc/scl:100/0, nullbl:1, octet:255, sign:1, radix:0
Exiting hgopcda, rc=0 at 2011/10/05-10:00:47
hgodscr, line 880: Printing hoada @ 0xdca9d0
MAX:2, ACTUAL:2, BRC:100, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x200:TREAT_AS_CHAR)
DTY         NULL-OK  LEN  MAXBUFLEN   PR/SC  CST IND MOD NAME
  4 INTEGER Y          4          4   0/  0    0   0   0 col1
12 VARCHAR Y        255        255   0/  0    0   0  200 col2
Exiting hgodscr, rc=0 at 2011/10/05-10:00:47
hostmstr:          0:      HOA After hoxdscr
hostmstr:          0: RPC After SQL Bundling
hostmstr:          0: RPC Before Describe Table
hostmstr:          0:      HOA Before hoadtab
Entered hgodtab at 2011/10/05-10:00:47
count:1
  table: test
Allocate hoada[0] @ 0xdcdd88
Entered hgopcda at 2011/10/05-10:00:47
Column:1(col1): dtype:4 (INTEGER), prc/scl:10/0, nullbl:1, octet:-1, sign:1, radix:10
Exiting hgopcda, rc=0 at 2011/10/05-10:00:47
Entered hgopcda at 2011/10/05-10:00:47
Column:2(col2): dtype:12 (VARCHAR), prc/scl:100/0, nullbl:1, octet:255, sign:1, radix:10
Exiting hgopcda, rc=0 at 2011/10/05-10:00:47
The hoada for table test follows...
hgodtab, line 876: Printing hoada @ 0xdcdd88
MAX:2, ACTUAL:2, BRC:1, WHT=6 (TABLE_DESCRIBE)
hoadaMOD bit-values found (0x200:TREAT_AS_CHAR)
DTY         NULL-OK  LEN  MAXBUFLEN   PR/SC  CST IND MOD NAME
  4 INTEGER Y          4          4   0/  0    0   0   0 col1
12 VARCHAR Y        255        255   0/  0    0   0  200 col2
Exiting hgodtab, rc=0 at 2011/10/05-10:00:47
hostmstr:          0:      HOA After hoadtab
hostmstr:          0:      HOA Before hoadafr
Entered hgodafr, cursor id 0 at 2011/10/05-10:00:47
Free hoada @ 0xdcdd88
Exiting hgodafr, rc=0 at 2011/10/05-10:00:47
hostmstr:          0:      HOA After hoadafr
hostmstr:          0: RPC After Describe Table
hostmstr:          0: RPC Before SQL Bundling
hostmstr:          0:      HOA Before hoxclse
Entered hgoclse, cursor id 1 at 2011/10/05-10:00:47
Exiting hgoclse, rc=0 at 2011/10/05-10:00:47
hostmstr:          0:      HOA After hoxclse
hostmstr:          0:      HOA Before hoadafr
Entered hgodafr, cursor id 1 at 2011/10/05-10:00:47
Free hoada @ 0xdca9d0
Exiting hgodafr, rc=0 at 2011/10/05-10:00:47
hostmstr:          0:      HOA After hoadafr
hostmstr:          0:      HOA Before hoxpars
Entered hgopars, cursor id 1 at 2011/10/05-10:00:47
type:0
SQL text from hgopars, id=1, len=48 ...
     00: 494E5345 52542020 494E544F 20227465  [INSERT  INTO "te]
     10: 73742220 2822636F 6C31222C 22636F6C  [st" ("col1","col]
     20: 32222920 56414C55 45532028 3F2C3F29  [2") VALUES (?,?)]
Exiting hgopars, rc=0 at 2011/10/05-10:00:47
hostmstr:          0:      HOA After hoxpars
hostmstr:          0:      HOA Before hoaexec
Entered hgoexec, cursor id 1 at 2011/10/05-10:00:47
octype=4 (INSERT)
hgoexec, line 108: Printing hoada @ 0xdcaa50
MAX:2, ACTUAL:2, BRC:1, WHT=3 (BIND_LIST)
hoadaMOD bit-values found (0x200:TREAT_AS_CHAR)
DTY         NULL-OK  LEN  MAXBUFLEN   PR/SC  CST IND MOD NAME
  3 DECIMAL N          1          0   0/  0    0   0   0 ?
12 VARCHAR N          4          0   0/  0  870   0  200 ?
Entered hgoprbv at 2011/10/05-10:00:47
hgoprbv, line 145: Printing hoada @ 0xdcaa50
MAX:2, ACTUAL:2, BRC:1, WHT=3 (BIND_LIST)
hoadaMOD bit-values found (0x200:TREAT_AS_CHAR)
DTY         NULL-OK  LEN  MAXBUFLEN   PR/SC  CST IND MOD NAME
  3 DECIMAL N          1          0   0/  0    0   0   0 ?
12 VARCHAR N          4          0   0/  0  870   0  200 ?
Exiting hgoprbv, rc=0 at 2011/10/05-10:00:47
{code}
End of the trace, session closed, nothing more in file
Regards
Bart Dabr                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              

Similar Messages

  • ORA-06502: error when inserting into table via db link with long datatype

    Folks,
    I am getting the following error:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small.
    This occurs when an insert is done via a database link into a table that has a LONG data type for one of the columns, and the string contains some carriage returns and or line feeds.
    I have checked by removing the db link, and inserting into a local table with identical column data types, where there is no error.
    So this might be another db link bug?
    So I need to remove the carriage returns and/or line feeds
    in my pl/sql block in the page process. I have tried
    l_text := REPLACE(l_text, CHR(10), ' ');
    l_text := REPLACE(l_text, CHR(13), NULL);
    but still getting the ORA-06502. Would really appreciate some advice here, please.
    Cheers
    KIM

    Scott,
    Time to 'fess up':
    My fault sorry, the error was coming from another page process where I had allowed insufficient string length for one of the variables, and my error message did not identify the page process clearly.
    This leads me to make a request for future releases, could the system error messages state which page process caused the problem?
    One other thing I notice, and this might be a feature not a fault, the page processes are numbered: "Page Process:      3 of 5". However process 3 is not the 3rd one to be processed, and probably refers to the order in which they are created. Should the number reflect the process order?
    Cheers
    KIM

  • Issue inserting into USER_SDO_GEOM_METADATA via Oracle Apex

    G'day All,
    I've originally riased my issue in "Application Express - http://forums.oracle.com/forums/thread.jspa?threadID=537922&tstart=45 " but have not had any solutions provided yet.
    Just a quick summary, when I insert a record into user_sdo_geom_metadata using Oracle Apex SQL Command tool and run a select on the view no records appear. After a bit of investigating I found it is wrongly being given a SDO_OWNER value of ANONYMOUS instead of the value from sys_context('userenv', 'CURRENT_SCHEMA') which in my case would be "TEST".
    When I run SELECT sys_context('userenv', 'CURRENT_SCHEMA') FROM DUAL it correctly returns "TEST".
    If anyone could let me know whats going wrong I would be most appreciated :)
    Cheers
    Mark

    try to
    grant select on table1 to schema2....
    Once you have granted the access to teh schema...you should be able to access the MDSYS schema.
    This should be OK.

  • Strange data inserted into table via table trigger

    Hi ,
    There is some strange phenomenon happen occasionally where some tables update records will have a TRIGGER to insert records into a table and once in a while, the record has some strange data inserted which looks like a memory corruption. It is running on 10.2.0.3.
    Does anyone ever encounter this before?
    Strange result:
    PRIM_KEY
    -3.614364951000000000000000000000000E-47
    -3.614364951000000000000000000000000E-47
    Normal result:
    PRIM_KEY
    1137KT
    1137KT
    ana

    Hi,
    What is strange in this? Its not memory corruption. Its just one of the numeric form of representation of number
    -3.614364951000000000000000000000000E-47it means -3.614364951 * 10 to the power of -47.
    Whatever value has been entered into the table depends on your business logic you coded, and user input.
    Regards

  • File to RFC problem- data is not inserting into ztable in R3 system

    Hi
    i have done File to RFC scenario which picks data from flat file and inserts into ztable via RFC in R3. but while testing my scenario everything is successful in XI monitoring (Successful flag in MONI and RWB) and in auditlog message status is DLVD.
    it seems to be everything successful in XI and RFC call also successful in R3 system.
    but for some reason data is not inserting into table (RFC is used to insert data into ztable)
    Is there any way to debug RFC call excecution in XI..?
    RFC code is like this:
    insert ZMM_AUTO_GR from INPUT_TABLE.
    commit work.
    END FUNCTION.
    please advice what could be the reason not inserting into table.
    Help would be appreciated.
    Regards,
    Rajesh

    Hi Praveen,
    please see audit log- from communication channel monitoring..
    Receiver channel 'CC_INCA_RFC_SAPECC_Receiver' for party '', service 'R3DCLNT210' (internal name 'RfcClient[CC_INCA_RFC_SAPECC_Receiver]')
    Client data: {jco.client.lang=EN, jco.client.snc_mode=0, jco.client.client=210, jco.client.passwd=******, jco.webas.ignore_jdsr_error=1, jco.client.user=jsaha, jco.client.sysnr=00, jco.client.ashost=ausr3devdc02}
    Repository data: {jco.client.lang=EN, jco.client.snc_mode=0, jco.client.client=210, jco.client.passwd=******, jco.webas.ignore_jdsr_error=1, jco.client.user=jsaha, jco.client.sysnr=00, jco.client.ashost=ausr3devdc02}
    Current pool size: 1, maximum pool size : 1
    Channel History
    - OK: 2008-07-28 04:32:04 PDT: Message processed for interface ZAUTO_GR_STAGE_INCA
    - OK: 2008-07-28 04:31:04 PDT: Message processed for interface ZAUTO_GR_STAGE_INCA
    - OK: 2008-07-28 03:56:56 PDT: Message processed for interface ZAUTO_GR_STAGE_INCA
    - OK: 2008-07-28 03:49:04 PDT: Message processed for interface ZAUTO_GR_STAGE_INCA
    - OK: 2008-07-28 03:48:04 PDT: Message processed for interface ZAUTO_GR_STAGE_INCA

  • ORA-22275 inserting into the CLOB column using ODBC input parameters

    Hi all,
    I'm having problem with INSERT into the CLOB column via bound input parameters.
    After calling SQLExecDirect() I'm getting following error:
    [Oracle][ODBC][Ora]ORA-22275: invalid LOB locator specified
    Adding defaults to the table definitions does not help. If I embed parameter values into the SQL statement - everything works just fine.
    I use Oracle 9.2 with latest Oracle ODBC driver 9.2.0.4 under Windows XP.
    Any ideas appreciated...
    Vlad
    Code looks like this:
    SQLBindParameter(hstmt,1,...);
    SQLBindParameter(hstmt,2,...);
    SQLBindParameter(hstmt,3,...);
    SQLExecDirect(hstmt,...);
    SQL statement looks like this:
    insert into tst_table (id,str_fld,clob_fld1,clob_fld2) values (50, ? , ? , ?)
    Table looks like this:
    CREATE TABLE tst_table (
         id          number (10,0)     NOT NULL ,
         str_fld          nvarchar2 (50)     NOT NULL ,
         clob_fld1     nclob          NOT NULL ,
         clob_fld2     nclob          NOT NULL ,
         CONSTRAINT PK_tst_table PRIMARY KEY
              id
    I tried to add defaults to the table, but result is the same:
    CREATE TABLE tst_table (
         id          number (10,0)               NOT NULL ,
         str_fld          nvarchar2 (50)               NOT NULL ,
         clob_fld1     nclob     default EMPTY_CLOB()     NOT NULL ,
         clob_fld2     nclob     default EMPTY_CLOB()     NOT NULL ,
         CONSTRAINT PK_tst_table PRIMARY KEY
              id

    You need to provide the data at execution time (i.e. SQL_LEN_DATA_AT_EXEC(0) in the SQLBindParameter followed by a series of SQLPutData calls). If you go to Metalink
    Top Tech Docs | Oracle ODBC Driver | Scripts & Sample Code
    has some sample code that shows you how to do this.
    Justin

  • Update/Insert mode couldn't apply to SQL Server source via Transparent Gateway.

    Hi all,
    OWB version is 9.0.2.56,database version is 9i Release 2.
    When set load type to "Insert",mapping works fine from SQL Server to Oracle table,via Transparent Gateway 901.
    But "Update/Insert" always runs error with "Fatal error or maximum number of errors exceeded".while I define both source and destination table to oracle tables in mapping,"Update/Insert" works file.
    Any suggestion?

    Hi Ignor,
    Thanks for your reply!
    The SQL Server version is SQL Server 2000.
    I just want to ETL data from a SQL Server table via Transparent gateway into oracle table,the source table has a increment seq field,so I want to define mapping using update/insert loading method in OWB,according to this seq field,if there is the same seq in the target table,do update,if not,insert the row.I just find out that if I use a middle table in oracle to do truncate/insert mode from SQL Server source table,then do update/insert mode from the middle one to target table,it works.But can't do directly from source to target using update/insert mode.Does this means update/insert mode only apply to mapping from local table to local table?
    Regards,
    Robbin

  • Insert into CLOB fails with Oracle ODBC driver version 9.02.00.65

    I tried to insert into CLOB using the latest Oracle ODBC driver 9.02.00.65 and it fails. But the same works with earlier versions of ODBC driver earlier to 9.02.00.65 ie., 9.02.00.63.
    Here is the code snippet I tried. Any help now is highly appreciated as I am in the crunch time.
    I tried the same code snippet with VARCHAR2 column with the same driver and it works.
    ** CONVDSN.C - This is the ODBC sample code for
    ** creating File DSN pointers to machine DSNs.
    **This code is furnished on an as-is basis as part of the ODBC SDK and is
    **intended for example purposes only.
    #include <windows.h>
    #include <stdio.h>
    #include <tchar.h>
    #include <sql.h>
    #include <sqlext.h>
    #include <odbcinst.h>
    #include <sqltypes.h>
    #define MAXDATALEN 25 //maximum data length per column
    #define MAX_COL 15 //maximum column in result set
    #define MAX_ROW 100 //maximum number of rows
    #define MAXBUFLEN 256
    #define SQLERR_FORMAT "SQL Error State:%s, Native Error Code: %lX, ODBC Error: %s"
    #define MAXDISPLAYSIZE MAX_COL*(MAXDATALEN+1)
    #define SQLWRNMSGTITLE "SQL_SUCCESS_WITH_INFO results"
    #define SQLERRCNTDTITLE "SQL_ERROR results continued"
    #define SQLWRNMSGTITLE "SQL_SUCCESS_WITH_INFO results"
    #define SQLWRNCNTDTITLE "SQL_SUCCESS_WITH_INFO results continued"
    #define NULLDATASTRING "SQL_NULL_DATA"
    #define SQLERRMSGTITLE "SQL_ERROR results"
    // prototypes
    void ExpandFileName(LPSTR szFileDSNName, LPCSTR szDSNName);
    void MakeLegalName(LPSTR szLegalDSNName, LPCSTR szDSNName);
    // main routine: Iterate through the user and system DSNs, creating a pointer
    // to each.
    void FAR PASCAL DisplayError(SQLRETURN nResult, HWND hWnd, SWORD fHandleType, SQLHANDLE handle);
    void insertSelectClob();
    void checkRcCode(RETCODE rc);
    int main (int argc, char* argv[])
         insertSelectClob();
    return 0;
    void FAR PASCAL DisplayError(SQLRETURN nResult, HWND hWnd, SWORD fHandleType, SQLHANDLE handle)
         UCHAR szErrState[SQL_SQLSTATE_SIZE+1]; // SQL Error State string
         UCHAR szErrText[SQL_MAX_MESSAGE_LENGTH+1]; // SQL Error Text string
         char szBuffer[SQL_SQLSTATE_SIZE+SQL_MAX_MESSAGE_LENGTH+MAXBUFLEN+1];
         // formatted Error text Buffer
         SWORD wErrMsgLen; // Error message length
         UDWORD dwErrCode; // Native Error code
         int iSize; // Display Error Text size
         SQLRETURN nErrResult; // Return Code from SQLGetDiagRec
         SWORD sMsgNum = 1;
         SWORD fFirstRun = TRUE;
         char szDispBuffer[MAXDISPLAYSIZE+1]; // Display Buffer
         szBuffer[0] = '\0';
         do
              // continue to bring messageboxes till all errors are displayed.
              // more than one message box may be reqd. as err text has fixed
              // string size.
              // initialize display buffer with the string in error text buffer
              strcpy(szDispBuffer, szBuffer);
              // call SQLGetDiagRec function with proper ODBC handles, repeatedly until
              // function returns SQL_NO_DATA. Concatenate all error strings
              // in the display buffer and display all results.
              while ((nErrResult = SQLGetDiagRec(fHandleType, handle, sMsgNum++,
                   szErrState, &dwErrCode, szErrText,
                   SQL_MAX_MESSAGE_LENGTH-1, &wErrMsgLen)) != SQL_NO_DATA)
                   if(nErrResult == SQL_ERROR || nErrResult == SQL_INVALID_HANDLE)
                   break;
                   wsprintf(szBuffer, SQLERR_FORMAT, (LPSTR)szErrState, dwErrCode, (LPSTR)szErrText);
                   iSize = strlen(szDispBuffer);
                   if (iSize && (iSize+strlen(szBuffer)+1) >= MAXDISPLAYSIZE)
                   break;
                   if (iSize)
                   strcat(szDispBuffer, "\n");
                   strcat(szDispBuffer, szBuffer);
              // display proper ERROR or WARNING message with proper title
              if (nResult == SQL_SUCCESS_WITH_INFO)
                   MessageBox(hWnd, szDispBuffer, (fFirstRun? SQLWRNMSGTITLE : SQLWRNCNTDTITLE),
                   MB_OK | MB_ICONINFORMATION);
              else
                   MessageBox(hWnd, szDispBuffer, (fFirstRun? SQLERRMSGTITLE : SQLERRCNTDTITLE),
                   MB_OK | MB_ICONEXCLAMATION);
              if (fFirstRun)
                   fFirstRun = FALSE;
         while (!(nErrResult == SQL_NO_DATA || nErrResult == SQL_ERROR || nErrResult == SQL_INVALID_HANDLE));
    void insertSelectClob()
    SQLCHAR clobdata[1001];
    SQLCHAR resultdata[1001];
    SQLINTEGER ind = SQL_DATA_AT_EXEC;
    SQLCHAR *bufp;
         SQLINTEGER cbOrderID = sizeof(SQLSMALLINT);
         SQLSMALLINT sTmp=13;
         SQLCHAR *sqlStmt1  = _T("INSERT INTO clobtbl(id, clob1) VALUES(?, ?)");
         SQLCHAR *sqlStmt2  = _T("SELECT id, clob1 FROM clobtbl");
    //     SQLCHAR *sqlStmt1  = _T("INSERT INTO testInsert(id, clob1) VALUES(?, ?)");
    // SQLCHAR *sqlStmt2  = _T("SELECT id, clob1 FROM testInsert");
    int clobdatalen, chunksize, dtsize, retchklen;
         HENV envHnd;
    HDBC conHnd;
    HSTMT stmtHnd;
    RETCODE rc;
         int nRowcnt=0;
         SQLPOINTER pToken = NULL;
    rc = SQL_SUCCESS;
    // ENV is allocated
    rc = SQLAllocEnv(&envHnd);
    // Connection Handle is allocated
    rc = SQLAllocConnect(envHnd, &conHnd);
    rc = SQLConnect(conHnd, T("testd734"), SQLNTS, T("ipathdba"), SQLNTS, T("ipathdba"), SQLNTS);
    printf(_T("Insert CLOB1 using SQLPutData...\n[%s]\n"), sqlStmt1);
    // Set CLOB Data
    int i;
    SQLCHAR ch;
    for (i=0, ch=_T('A'); i< sizeof(clobdata)/sizeof(SQLCHAR); ++i, ++ch)
    if (ch > _T('Z'))
    ch = _T('A');
    clobdata[i] = ch;
    clobdata[sizeof(clobdata)/sizeof(SQLCHAR)-1] = _T('\0');
    clobdatalen = lstrlen(clobdata); // length of characters
    chunksize = clobdatalen / 7; // 7 times to put
         rc = SQLAllocHandle(SQL_HANDLE_STMT, conHnd, &stmtHnd);
    // Step 1: Prepare
    rc = SQLPrepare(stmtHnd, sqlStmt1, SQL_NTS);
    // checkSQLErr(envHnd, conHnd, stmtHnd, rc);
    // Step 2: Bind Parameter with SQL_DATA_AT_EXEC
    rc = SQLBindParameter(stmtHnd,
    1,
    SQL_PARAM_INPUT,
    SQL_C_SSHORT,
    SQL_INTEGER,
    0,
    0,
    &sTmp,
    0,
    &cbOrderID);
    rc = SQLBindParameter(stmtHnd,
    2,
    SQL_PARAM_INPUT,
    SQL_C_CHAR,
    SQL_LONGVARCHAR,
    clobdatalen*sizeof(CHAR),
    0,
    (SQLPOINTER)clobdata,
    clobdatalen*sizeof(CHAR),
    &ind);
    // checkSQLErr(envHnd, conHnd, stmtHnd, rc);
    // Step 3: Execute
    rc = SQLExecute(stmtHnd);
         while (rc == SQL_NEED_DATA) {
              rc = SQLParamData(stmtHnd, &pToken);
              if (rc == SQL_NEED_DATA) {
                   for (dtsize=0, bufp = clobdata;
                        dtsize < clobdatalen;
                        dtsize += chunksize, bufp += chunksize)
                   int len;
                   if (dtsize+chunksize < clobdatalen)
                        len = chunksize;
                        rc = SQLPutData(stmtHnd, bufp, len*sizeof(SQLCHAR));
                   else
                        len = clobdatalen-dtsize;
                        rc = SQLPutData(stmtHnd, bufp, SQL_NTS);
              rc = SQLParamData(stmtHnd, &pToken);
    // Fails as row count retrieved is zero.
         rc = SQLRowCount(stmtHnd, &nRowcnt);
         if(rc != SQL_SUCCESS)
              DisplayError(rc, NULL, SQL_HANDLE_ENV, conHnd);
    rc = SQLFreeStmt(stmtHnd, SQL_CLOSE);
    printf(_T("Finished Update\n\n"));
    rc = SQLAllocStmt(conHnd, &stmtHnd);
    if (rc != SQL_SUCCESS)
    printf(_T("Failed to allocate STMT\n"));
    exit(-1);
    // Clear Result Data
    memset(resultdata, 0, sizeof(resultdata));
    chunksize = clobdatalen / 15; // 15 times to gut
    rc = SQLExecDirect(stmtHnd, sqlStmt2, SQL_NTS); // select
         if(rc != SQL_SUCCESS)
              DisplayError(rc, NULL, SQL_HANDLE_ENV, conHnd);
    // Step 2: Fetch
    rc = SQLFetch(stmtHnd);
    for(dtsize=0, bufp = resultdata;
    dtsize > sizeof(resultdata)/sizeof(CHAR) && rc != SQL_NO_DATA;
    dtsize += chunksize-1, bufp += chunksize-1)
    int len; // len should contain the space for NULL termination
    if (dtsize+chunksize<sizeof(resultdata)/sizeof(CHAR))
    len = chunksize;
    else
    len = sizeof(resultdata)/sizeof(CHAR)-dtsize;
    // Step 3: GetData
    rc = SQLGetData(stmtHnd,
    2,
    SQL_C_CHAR,
    (SQLPOINTER)bufp,
    len*sizeof(CHAR),
    &retchklen);
    if (!_tcscmp(resultdata, clobdata))
    printf(_T("Succeeded!!\n\n"));
    else
    printf(_T("Failed!!\n\n"));
         if (conHnd)
              SQLFreeConnect(conHnd);
         if (envHnd)
              SQLFreeEnv(envHnd);
    }

    Hi,
    Since 9.2 has been desupported for error correction you will not be able to download that version from OTN. You should ask whoever is providing the training if their is an alternate version you can use. The only versions that you will be able to download from oracle.com is 10.2 11.1, and 11.2.

  • Insert byte[] into postgres text-field

    Hi,
    i made some tries on using postgresql and jdbc, i noticed that
    for some reason the postgres jdbc.driver does not convert
    text from the db correct to UNICODE. The db is in ISO-8859-1.
    So, i tried to write a workaround to this and was successfull
    for reading data. The code is this:
    try {
        String  sOrt   = null;
        InputStreamReader isString;
        BufferedReader bisString;
        ResultSet result =
            stmt.executeQuery( "select * from adresse.ort" );
        while( result.next() ) {
            isString = new InputStreamReader(
                                result.getBinaryStream( "ort" ),
                                "ISO-8859-1" );
            bisString = new BufferedReader( isString );
            sOrt = bisString.readLine();
    ...This works fine. Now i also wanted to but a correctly convertet
    String in the db.
    And i tried so:
    try {
        String sOrt = "solal�";    // note the special german char �
        byte[] sOrt_ba = sOrt.getBytes( "ISO-8859-1" );
        pstmt = con.prepareStatement( "insert into adresse.ort " +
                                      "(ort, vorwahl_o, id_land) " +
                                      " values " +
                                      "(?, '00000', 1)" );
        pstmt.setBytes( 1, sOrt_ba );
        int sRows;
        sRows = pstmt.executeUpdate();
    }but this sets not the correct character for the special char �
    but instead puts the byte-value \366 into the db.
    My question is as simple as the answer might be complex, what am
    i doing wrong, and how can i accomplish this.

    i found a solution for me, its not clean (to be sure its very ugly) but it works for the moment, if anyone has a better idea please tell. I will make the
    following.
    create a small plpgsql function like this.
    CREATE FUNCTION jdbc_clean(text) RETURNS text AS'
        DECLARE
            ret text;
        BEGIN
            SELECT INTO ret replace($1, ''\\\\344'', ''�'');
            SELECT INTO ret replace(ret, ''\\\\366'', ''�'');
            SELECT INTO ret replace(ret, ''\\\\374'', ''�'');
            SELECT INTO ret replace(ret, ''\\\\337'', ''�'');
            RETURN ret;
        END;
    ' LANGUAGE 'plpgsql'and call this in my Java-method for every String i inserted or
    updated in a seperate update query.
    I have not written it for now, but i guess this will be working.

  • My Internal HD became corrupt and it would not boot up so I installed My osx onto a new HD via usb and then inserted into my macbook pro but it wont boot up. It will only boot up if i connect via usb how can i boot it as an internal HD?

    My Internal HD became corrupt and it would not boot up so I installed My osx onto a new HD via usb and then inserted into my macbook pro but it wont boot up. It will only boot up if i connect via usb how can i boot it as an internal HD?

    Shootist007 wrote:
    If the system won't boot from the new drive the OP bought and install OS X on it it certainly won't boot from the original drives Recovery HD partition.
    Sorry genius.....but if the Recovery disk shows up that means the disk cable isn't bad.  Could be he did have a screwed up HDD and when he put the NEW HDD in (after putting the OS on it via USB) the computer didn't reconize it and therefore didn't boot the OS.  Just maybe right genius?  Don't rush to criticize someone's recommendations until you realize other possibilities.  (I did say "if it does")
    Thank you

  • How query data in pl/sql via ODBC from DB2 on AS400

    Hi,
    What's the most easy way to do some selects on tables in an external (non-oracle)database via odbc?
    I only need selects, no dml-statements like inserts en updates...
    Where can I find more information about this subject?
    Filip

    You need to use Oracle Heterogeneous Services. Firstly you have to obtain and configure DB2 ODBC drivers. I got mine from ibm.com (not free) but I am sure there are some third party vendors out there. I don't know much about DB2 so I can't help you with the configuration (I asked a DB2 DBA to help me with that part).
    The rest is just setting up Oracle HS and creating the DB link. The following steps should help but there are much more detailed manuals for Oracle HS on http://tahiti.oracle.com.
    Listener Configuration
    Add the following entry into the SID_LIST part of the listener. The SID_NAME will be used in the heterogeneous services configuration
    (SID_DESC=
    (SID_NAME=db2)
    (ORACLE_HOME=D:\oracle\ora92)
    (PROGRAM=hsodbc)
    Restart the listener.
    Heterogeneous Service Configuration
    Under ORACLE_HOME\HS\admin create the following text file called initDB2.ora (the DB2 part should match the SID_NAME used in the listener configuration).
    Put the following line in the text file (the DQ01 is the name of the DB2 ODBC System DSN):
    HS_FDS_CONNECT_INFO=DQ01
    Client Configuration
    The client side refers to an Oracle database that will use the heterogeneous gateway.
    TNSNames Entry
    Put the following entry in the tnsnames.ora file (the SID part should match the SID_NAME in the listener configuration):
    DB2.telkom.co.za =
    (DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST=cntrra20-esdt00)(PORT=1521))
    (CONNECT_DATA=(SID=db2))
    (HS=OK)
    Database Link
    Create a database link that references the new tnsnames.ora entry:
    create public database link db2
    connect to oratst identified by oracle using 'db2';
    Test the database link.

  • Problem with boolean type in Informix via ODBC

    Hello,
    I'm connecting to an Informix database from an Oracle database via the ODBC Gateway. The connection works fine.
    However, when I select a boolean type column from a table in the Informix database, nothing is returned and I get the following error:
    SQL> select "stat" from bt@informix;
    ERROR:
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    [Informix][Informix ODBC Driver]Restricted data type attribute violation.
    {07006,NativeErr = -11013}
    ORA-02063: preceding 2 lines from INFORMIX
    no rows selected
    Selecting a boolean type column with isql works fine. Other column types work from Oracle.
    Can anyone help me resolve this issue? Please find configuration details and traces below.
    Software stack:
    Informix Database: Enterprise Edition 12.10 for Linux x86_64
    Informix ODBC driver: Informix Client SDK Developer Edition 4.10 for Linux 64-bit
    Oracle Database: Enterprise Edition 11.2.0.1.0 64-bit (Oracle Linux 6.6 64-bit)
    UnixODBC: 2.3.2 x86_64
    odbcinst.ini:
    [Informix]
    Driver=/opt/IBM/informix/lib/cli/libifcli.so
    Setup=/opt/IBM/informix/lib/cli/libifcli.so
    APILevel=1
    ConnectFunctions=YYY
    DriverODBCVer=03.51
    FileUsage=0
    SQLLevel=1
    smProcessPerConnect=Y
    [ODBC]
    TraceFile=/tmp/odbc.log
    Trace = Yes
    odbc.ini:
    [ol_informix1210]
    Driver=Informix
    Description=Test connection
    Database=sysutils
    LogonID=informix
    pwd=informix
    Servername=ol_informix1210
    CursorBehavior=0
    DB_LOCALE=en_us.8859-1
    TRANSLATIONDLL=/opt/IBM/informix/lib/esql/igo4a304.so
    [ODBC]
    UNICODE=UCS-2
    ; Trace file Section
    Trace=1
    TraceFile=/tmp/odbctrace.out
    InstallDir=/opt/IBM/informix
    TRACEDLL=idmrs09a.so
    Oracle Gateway init.ora:
    HS_FDS_CONNECT_INFO=ol_informix1210
    HS_FDS_SHAREABLE_NAME=/usr/local/lib/libodbc.so
    HS_FDS_TRACE_LEVEL=debug
    HS_LANGUAGE=AMERICAN_AMERICA.WE8ISO8859P1
    Oracle Gateway trace:
    Entered hgoftch, cursor id 1 at 2015/04/14-12:22:03
    hgoftch, line 130: Printing hoada @ 0x2007fe0
    MAX:1, ACTUAL:1, BRC:100, WHT=5 (SELECT_LIST)
    hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY)
    DTY     NULL-OK  LEN  MAXBUFLEN   PR/SC  CST IND MOD NAME
    -7 BIT Y          1          1   0/  0    0   0  20 stat
    Performing delayed open.
    SQLBindCol: column 1, cdatatype: -28, bflsz: 1
    Entered hgopoer at 2015/04/14-12:22:03
    hgopoer, line 233: got native error -11013 and sqlstate 07006; message follows...
    [Informix][Informix ODBC Driver]Restricted data type attribute violation. {07006,NativeErr = -11013}
    Exiting hgopoer, rc=0 at 2015/04/14-12:22:03
    hgoftch, line 730: calling SQLFetch got sqlstate 07006
    0 rows fetched
    Exiting hgoftch, rc=28500 at 2015/04/14-12:22:03 with error ptr FILE:hgoftch.c LINE:730 FUNCTION:hgoftch() ID:Fetch resultset data
    ODBC trace:
    [ODBC][11041][1429005970.973443][SQLPrepare.c][196]
                    Entry:
                            Statement = 0x276ecb0
                            SQL = [SELECT A1. stat  FROM  BT  A1][length = 29]
    [ODBC][11041][1429005970.973914][SQLPrepare.c][371]
                    Exit:[SQL_SUCCESS]
    [ODBC][11041][1429005970.973940][SQLNumResultCols.c][156]
                    Entry:
                            Statement = 0x276ecb0
                            Column Count = 0x26f5868
    [ODBC][11041][1429005970.973970][SQLNumResultCols.c][248]
                    Exit:[SQL_SUCCESS]
                            Count = 0x26f5868 -> 1
    [ODBC][11041][1429005970.974097][SQLDescribeCol.c][247]
                    Entry:
                            Statement = 0x276ecb0
                            Column Number = 1
                            Column Name = 0x7fffc3ff2d90
                            Buffer Length = 31
                            Name Length = 0x7fffc3ff2ed4
                            Data Type = 0x7fffc3ff2ed8
                            Column Size = 0x7fffc3ff2e70
                            Decimal Digits = 0x7fffc3ff2edc
                            Nullable = 0x7fffc3ff2ee0
    [ODBC][11041][1429005970.974140][SQLDescribeCol.c][501]
                   Exit:[SQL_SUCCESS]               
                            Column Name = [stat]               
                            Data Type = 0x7fffc3ff2ed8 -> -7               
                            Column Size = 0x7fffc3ff2e70 -> 1               
                            Decimal Digits = 0x7fffc3ff2edc -> 0               
                            Nullable = 0x7fffc3ff2ee0 -> 1
    [ODBC][11041][1429005970.974192][SQLSetStmtAttr.c][265]
                    Entry:
                            Statement = 0x276ecb0
                            Attribute = SQL_ATTR_ROW_ARRAY_SIZE
                            Value = 0x64
                            StrLen = 0
    [ODBC][11041][1429005970.974218][SQLSetStmtAttr.c][925]
                    Exit:[SQL_SUCCESS]
    [ODBC][11041][1429005970.974230][SQLSetStmtAttr.c][265]
                    Entry:
                            Statement = 0x276ecb0
                            Attribute = SQL_ATTR_ROW_BIND_TYPE
                            Value = (nil)
                            StrLen = -5
    [ODBC][11041][1429005970.974249][SQLSetStmtAttr.c][925]
                    Exit:[SQL_SUCCESS]
    [ODBC][11041][1429005970.974837][SQLExecute.c][187]
                    Entry:
                            Statement = 0x276ecb0
    [ODBC][11041][1429005970.975231][SQLExecute.c][348]
                    Exit:[SQL_SUCCESS]
    [ODBC][11041][1429005970.975255][SQLSetStmtAttr.c][265]
                    Entry:
                            Statement = 0x276ecb0
                            Attribute = SQL_ATTR_ROW_STATUS_PTR
                            Value = 0x27f5b78
                            StrLen = -4
    [ODBC][11041][1429005970.975280][SQLSetStmtAttr.c][925]
                    Exit:[SQL_SUCCESS]
    [ODBC][11041][1429005970.975291][SQLSetStmtAttr.c][265]
                    Entry:
                            Statement = 0x276ecb0
                            Attribute = SQL_ATTR_ROWS_FETCHED_PTR
                            Value = 0x26f5850
                            StrLen = -4
    [ODBC][11041][1429005970.975311][SQLSetStmtAttr.c][925]
                    Exit:[SQL_SUCCESS]
    [ODBC][11041][1429005970.975326][SQLBindCol.c][236]
                    Entry:
                            Statement = 0x276ecb0
                            Column Number = 1
                            Target Type = -28 SQL_C_UTINYINT
                            Target Value = 0x27f5af8
                            Buffer Length = 1
                            StrLen Or Ind = 0x27f5eb8
    [ODBC][11041][1429005970.975349][SQLBindCol.c][341]
                    Exit:[SQL_SUCCESS]
    [ODBC][11041][1429005970.975367][SQLFetch.c][162]
                    Entry:
                            Statement = 0x276ecb0
    [ODBC][11041][1429005970.975455][SQLFetch.c][348]
                    Exit:[SQL_ERROR]
                    DIAG [07006] [Informix][Informix ODBC Driver]Restricted data type attribute violation.
    [ODBC][11041][1429005970.975574][SQLGetDiagRec.c][758]
                   Entry:
                            Statement = 0x276ecb0
                            Rec Number = 1
                            SQLState = 0x7fffc3ff2e20
                            Native = 0x7fffc3ff2c14
                            Message Text = 0x7fffc3ff2c20
                            Buffer Length = 510
                            Text Len Ptr = 0x7fffc3ff2e70
    [ODBC][11041][1429005970.975615][SQLGetDiagRec.c][795]
                    Exit:[SQL_SUCCESS]
                            SQLState = 07006
                            Native = 0x7fffc3ff2c14 -> -11013
                            Message Text = [[Informix][Informix ODBC Driver]Restricted data type attribute violation.]
    [ODBC][11041][1429005970.975642][SQLGetDiagRec.c][758]
                    Entry:
                            Statement = 0x276ecb0
                            Rec Number = 2
                            SQLState = 0x7fffc3ff2e20
                            Native = 0x7fffc3ff2c14
                            Message Text = 0x7fffc3ff2c20
                         Message Text = 0x7fffc3ff2c20
                            Buffer Length = 510
                            Text Len Ptr = 0x7fffc3ff2e70
    [ODBC][11041][1429005970.975667][SQLGetDiagRec.c][795]
                    Exit:[SQL_NO_DATA]

    Here are my findings after consulting the unixODBC mailing list and the IBM documentation.
    There are several levels of data types at play here: native Informix SQL types, Informix ODBC driver SQL types and Informix ODBC driver C types (as well as standard C types).
    According to the Informix documentation (http://www-01.ibm.com/support/knowledgecenter/SSGU8G_11.70.0/com.ibm.odbc.doc/ids_odbc_108.htm), the ODBC driver SQL type for the native boolean type is SQL_BIT.
    The traces show that the ODBC SQL type is SQL_BIT (type code -7) and that this should be converted into the SQL_C_UTINYINT ODBC C type (type code -28).
    Oracle ODBC Gateway trace:
    DTY    NULL-OK  LEN  MAXBUFLEN  PR/SC  CST IND MOD NAME
    -7 BIT Y          1          1  0/  0    0  0  20 stat
    Performing delayed open.
    SQLBindCol: column 1, cdatatype: -28, bflsz: 1
    unixODBC trace:
    ODBC][11041][1429005970.975326][SQLBindCol.c][236]
                    Entry:
                            Statement = 0x276ecb0
                            Column Number = 1
                           Target Type = -28 SQL_C_UTINYINT
                            Target Value = 0x27f5af8
                            Buffer Length = 1
                            StrLen Or Ind = 0x27f5eb8
    [ODBC][11041][1429005970.975349][SQLBindCol.c][341]
    Oracle tries to bind the SQL_BIT type column to a buffer of SQL_C_UTINYINT type, which requires a conversion from SQL_BIT to SQL_C_UTINYINT  that is apparently not supported by the Informix ODBC Driver.
    According to the documentation (http://www-01.ibm.com/support/knowledgecenter/SSGU8G_11.70.0/com.ibm.odbc.doc/ids_odbc_108.htm) the Informix ODBC driver can only convert the SQL_BIT ODBC SQL type into SQL_C_BINARY, SQL_C_BIT and SQL_C_CHAR ODBC C types. (The ODBC C types are in turn converted into standard C types, for example the SQL_C_BIT type is converted into UCHAR which is a typedef for the standard C type unsigned char.)
    A possible workaround could be to tell Informix to present boolean as a different ODBC SQL type, for example SQL_CHAR (as it would be possible with PostgreSQL by setting BoolAsCharater=1 in odbc.ini), but Informix only seems to supports the SQL_BIT ODBC SQL type.
    A cumbersome workaround is to use the Gateway's pass-through feature that allows a query to be passed to Informix as is, which in turn allows us to cast the boolean field into a character field:
    SQL> set serveroutput on
    SQL> r
      1  DECLARE
      2    val  VARCHAR2(1);
      3    c    INTEGER;
      4    nr  INTEGER;
      5  BEGIN
      6    c := DBMS_HS_PASSTHROUGH.OPEN_CURSOR@informix;
      7    DBMS_HS_PASSTHROUGH.PARSE@informix(c,'select cast (stat as character) from bt');
      8    LOOP
      9    nr := DBMS_HS_PASSTHROUGH.FETCH_ROW@informix(c);
    10    EXIT WHEN nr = 0;
    11    DBMS_HS_PASSTHROUGH.GET_VALUE@informix(c, 1, val);
    12    DBMS_OUTPUT.PUT_LINE(val);
    13    END LOOP;
    14    DBMS_HS_PASSTHROUGH.CLOSE_CURSOR@informix(c);
    15  END;
    16*
    t
    f
    PL/SQL procedure successfully completed
    Easier solutions are still welcome.

  • Weird exception in 12c (ORA-01461: can bind a LONG value only for insert into a LONG column)

    I have a Windows app that accesses an Oracle 12c database via ODBC (the driver version is 12.01.00.01).
    I have a table that has a key column named REGION_ID (NVARCHAR2(9)), and about a dozen other columns, three of which are named REGION1, REGION2, and REGION3, all of type NVARCHAR2(40).
    When I try to insert a string into the REGION1 field that's greater than 9 characters (the length of REGION_ID), I get an ORA-01461 error ('Can bind a LONG value only for insert into a LONG column). If I define the length of REGION_ID to be NVARCHAR2(15), then I can add strings to the REGION1 field with a length up to 15 before I get the ORA-01461 exception again. Oddly, if I change the REGION1 column name to REGIONONE, I do not get any errors, and everything works fine. It's almost as if the column name REGION1 is being confused with REGION_ID behind the scenes.
    Any ideas? I’m using SQLBindParameter to bind the columns, and all of the calls succeed. I get the exception when I execute the insert statement. This same code worked for previous versions of Oracle (11g, 10g, and 9i). And if I use an 11g client driver against the 12c server, I do not get the exception.
    Thanks!

    Sorry, I was just now able to install the patch for bug 18232462, and it did indeed solve the issue I described above. Thanks!

  • BCP-style bulk insert from remote C++ ODBC Native client application

    I am trying to find documentation or sample code for performing bulk inserts into SQL Server 2012 from a remote client using the ODBC native client driver from Linux.  We currently perform INSERT statements on blocks of data, wrapping it in BEGIN/COMMIT,
    and achieving through approximately half of bcp reading from a delimited text file.  While there are many web pages talking about bulk inserts via the native driver, this page (http://technet.microsoft.com/en-us/library/ms130792.aspx) seems closest to
    what I'm after but doesn't go into any detail or give API calls.  The referenced header file is just a bunch of options and constants, so presumablyone gains access to bulk functions via the standard ODBC mechanism, the question is how.
    For clarity, I am NOT interested in:
    BULK INSERT: because it requires a server-side data file or a UNC path with appropriate permissions (doesn't work from Linux)
    INSERT ... SELECT
    * FROM OPENROWSET(BULK...): same problem as above
    IRowsetFastload: OLEDB, but I need ODBC on Linux.
    Basically, I want to emulate BCP.  I don't want to *run* BCP because it requires landing data to disk. 
    Thanks
    john
    John Lilley Chief Architect RedPoint Global Inc.

    Other than block inserts within BEGIN/COMMIT transaction blocks or running bcp, is there anything else that can be done on Linux?
    No other option from Linux that I am aware of.  The SQL Server Native Client ODBC driver also supports table-valued-parameters, which can be used to stream data but the Linux ODBC driver API doesn't have a way to do that either.  That said, I would
    still expect file-based BCP to significantly outperform inserts with large batches.  I've seen a rate of 100K/sec. with this technique, including the file create overhead but much depends on the particulars of your use case.
    Consider voting for this on Connect.  BCP is on the roadmap but no date yet: 
    https://connect.microsoft.com/SQLServer/SearchResults.aspx?SearchQuery=linux+odbc+bcp
    Also, I filed a Connect item for TVP support:
    https://connect.microsoft.com/SQLServer/feedback/details/874616/add-tvp-support-to-sql-server-odbc-driver-for-linux
    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

  • Running INSERT into SQL Server using Heterogeneous Services

    I am running into a show stopping issue trying to insert into a SQL Server table via Oracle.
    Basically, I have my Heterogeneous Services set up correctly and I am able to hit the SQL Server database with my INSERT statement. But what is happening is I seem to be manually controlly row locks. I believe HS is issuing the following to the server before my INSERT statement is run:
    SET TRANSACTION ISOLATION LEVEL READ COMMITTED
    SET IMPLICIT_TRANSACTIONS ON
    Also, it does not seem that I ever issue the COMMIT TRANSACTION
    command. This leaves the row locked forever... unable to complete the
    insert generating an error and not inserting my record.
    I would GREATLY appreciate any help you could provide, this is a critical issue.
    Thanks in advance,
    ivalum21

    ORA-02047: cannot join the distributed transaction in progress
    ORA-06512: at "MY_PACKAGE_NAME", line 263
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    [Generic Connectivity Using ODBC]DRV_Execute: DB_ODBC_ENGINE (1645): ;
    [Microsoft][ODBC SQL Server Driver][SQL Server]Disallowed implicit conversion
    from data type varchar to data type money, table 'tableA',
    column 'total_amount'. Use the CONVERT function to run this query. (SQL
    State: 37000; SQL Code: 260)
    ORA-02063: preceding 2 lines from SQLSERVER_LINK
    ORA-06512: at "RCDTPUMP.CAMPUSCALL_DATAPUMP_UNI", line 875
    ORA-06512: at "RCDTPUMP.CAMPUSCALL_DATAPUMP_UNI", line 791
    ORA-06512: at "RCDTPUMP.CAMPUSCALL_DATAPUMP_UNI", line 1156
    ORA-06512: at line 1
    That is what I get when I take out the TO_NUMBER()
    Message was edited by:
    ivalum21

Maybe you are looking for

  • 1099 amounts not being combined when more than one vendor same TIN

    I have multiple vendors within the same company code with the same tax id number. When the 1099's are generated, the amounts for both vendore are not getting combined. So if for one of the vendors, he has been paid $4850.00 on one vendor number, and

  • Run-time errors--need help

    Hi everyone, I'd greatly appreciate some help with this java program...here's the problem: Create a class Person that does the following: 1. Set the Last Name only 2. Set the First Name only 3. Set the Middle Name only 4. Gets the First Name 5. Gets

  • ORA-12560: TNS:protocol adapter error. Running sqlplus in different paths.

    Hi, Title: ORA-12560: TNS:protocol adapter error. Running sqlplus in different paths. Very strange. We have windows host, 32 bit oracle software 10g, 64 bit sap kernel X64. We have done Kernel patch yesterday and it was successful, system up and runn

  • Stopping NT Service Server

    Hello All, My question concerns stopping a managed server once it has been installed and started as an NT Service. What we want to do is to shutdown our server at night in order to do database backups. Once we have our managed server running as a man

  • Need Opinions on Connect-time failover for Oracle Parallel Server

    Has anyone had any experience using the (failover=on) setting in TNSNAMES.ora file? Specifically has anyone had any issues using this feature from a JDBC application? Horror stories? Good news? Anything? Thanx....