Precompilers, OCI & OCCI :: Data Lost After Adding Null Terminator For VARCHAR Data Received From Database

Dec 13, 2010

We are migrating a proc application as described below.

Old Env: UNIX
Old DB: Oracle 8i

New Env: Linux
New DB: Oracle 11g

New modules are successfully compiled in Linux environment. But we are facing issues in writing the output of VARCHAR datatype to a file.

find below the extract of code.
EXEC SQL BEGIN DECLARE SECTION;
varchar mcolmnvarchar[4];
EXEC SQL END DECLARE SECTION;

EXEC SQL DECLARE crs CURSOR FOR
SELECT NVL(colmn,' ') FROM table1

memset(mcolmnvarchar.arr,'�',4); //Was added for only Linux migration. Not present in unix env.

EXEC SQL FETCH c1 INTO :mcolmnvarchar;

cout << "Data at Stage one"<< mcolmnvarchar << endl;
mcolmnvarchar.arr[mcolmnvarchar.len]='�';
cout << "Data at Stage two"<< mcolmnvarchar << endl;
fprintf(fptr,"%-4s",mcolmnvarchar.arr);

Above code works absolutely fine in Unix env with Oracle 8i. But with Linux env & Oracle 11g it is not working. No compilation or run time errors. Data at Stage one prints the output of database properly. But after null terminator code, Data at Stage two statement prints without any value. Value is lost after null terminator code.

View 7 Replies


ADVERTISEMENT

Precompilers, OCI & OCCI :: NULL Values In C Structures?

May 18, 2010

I use a cursor to select records from a database table into a C structure as follows...

{
int iLoop = 0;
int iResult = 0;

[Code]....

The otc_multiplier field is NULL. As is the to_date sometimes. However, when I output the records later, the entries where the to_date is NULL come out fine (no value). But the otc_multiplier is getting output as 0.0 using...

// this is output later in another fuction using the following..
sprintf(newRecord, "%.1f",daServiceRecs->itemMultiplier);

If using c structures in this manner, what is the method for ensuring that numeric values are set to NULL when required?

View 2 Replies View Related

Precompilers, OCI & OCCI :: Transferring Data Between Two Databases

Apr 18, 2009

I am current using Pro*C to upload data from a flat file to database.

Now I have to transfer information(data) between databases. As a rookie, I do not know an efficient of way doing it.

View 4 Replies View Related

Precompilers, OCI & OCCI :: Getting Trailing Characters Inserted For Blob Data?

Jul 15, 2010

I am seeing some trailing characters in the coloumn when we are inserting Blob. I am doing SQLBindParameter with SQL_C_BINARY and SQL_LONGVARBINARY as InputOutputType and ValueType respectively.Do you see any problem in this. I get this problem when I am running Oracle 11 g client on an Windows 2008 Server 64bit.When the same set of query is fired from Windows 2003 Server 32bit with Oracle 10g it works fine and no trailing character gets inserted.

View 6 Replies View Related

Precompilers, OCI & OCCI :: Unable To Insert XML Data Into Type Table?

Dec 16, 2008

I want to insert XML data into my ( Oracle 11G Release 1 ) XMLType table using OCCI. I'm getting

ORA-01461: can bind a LONG value only for insert into a LONG column

My XML data size is around 1.5 to 2MB. I have also tried using setMaxParamSize before calling the setString method. But, still I'm getting the same exception.

How to resolve this issue?

View 2 Replies View Related

Precompilers, OCI & OCCI :: Data Loading Of French Input File

Aug 16, 2012

I am trying to load a input flat file (french data in it) into the database using pro*c (not using sql loader because of some validations ). i am reading the line by line and populating it into the structure and then process it.

The input file is encoded in WE8ISO8895P1 , I want the records to be populated into a table. so i did set NLS_LANG=French_France.WE8ISO8895P1 and ran the pro*c program . i used character host variable in the insert query , i used data from the earlier read structure and set these character host variable.

The problem i am facing is , when i am printing the values before insert i could see correct data.

For example the printed data of variable is "pas de donné " and strlen is 14. the target table field is of varchar type
( name varchar(20 char) )

but after i insert i could see only the truncated value in the database i.e "pas de donn" in the table length is 11.

View 17 Replies View Related

Client Tools :: SQL Developer Data Wizard - Row Terminator?

Sep 25, 2011

I'm new to SQL Developer and am using the wizard to import a dataset with a non-standard row terminator.The row terminator is essentially 2 spaces back to back.

In SQL Server I specified the following in the SQL Server wizard and it worked:

{CR}{LF}{CR}{LF}

What's the equivalent for oracle?

View 2 Replies View Related

Server Utilities :: Field / Record Terminator - Trailing Null Col

Oct 7, 2010

I need to load a file with fields separated by '|^|' and at end of each record has '||*||'.

So in my ctl file what do i mention ? fields terminated by '|^|' ? for the record termination wat should I say?
Should I still mention 'trailing null col' in my ctl file...?

Sample data file:
Name|^|Age|^|city||*||
john|^|33|^|||*||
james|^||^|nyc||*||
ken|^|44|^|
washington||*||

the fields are properly terminated with |^| and the records are terminated with ||*||. Is it true that a file with |^| as field terminator cannot be loaded with sqlldr?

View 3 Replies View Related

Precompilers, OCI & OCCI :: Demo Directory To Connect Database

Nov 30, 2008

i used example in demo directory to connect Database.I used "ansidyn1" example. But i can connect to my DB.I have just modified oracle_connect in sample code(in ansidyn1.pc),follow it:

EXEC SQL BEGIN DECLARE SECTION;
VARCHAR username[128];
VARCHAR password[32];
char DB_NAME[30] = "servertest";
char db_string[20]= "vitcendb";
EXEC SQL END DECLARE SECTION;
[code]....

i compiled in in VC6++(using ansidyn.dsp) but cant connect to DB.

View 1 Replies View Related

Precompilers, OCI & OCCI :: Write A Program Using Oci To Login Into Oracle Database?

Mar 28, 2006

I want write a program using oci to login into oracle database.Advance security option for the oracle server is set to kerberos authentication. Is it possible to login to the oracle database through olog() function.

Initial ticket is required in kerberos authentication. So is it also needed durinfg the login from my programme.

View 1 Replies View Related

Precompilers, OCI & OCCI :: Connecting To Oracle Database With Instant Client 11.01.06

Mar 19, 2009

connecting to an oracle db with the instant client 11.01.06. I can connect to the db via other tools like sqldbx or SqlTools 1.5 which are also using oci. So now I tried it with c++ using Visual Studio 2005 SP1.

First I tried this

Environment* env=Environment::createEnvironment(Environment::DEFAULT);
Connection* con=NULL;
try{
con=env->createConnection("user","pwd","//servername:ip/mydb");
}

and got following error: "the attribute OCI_ATTR_USERNAME is greater than the maximum allowable length of 255".

So I tried:

Environment* env=Environment::createEnvironment(Environment::DEFAULT);
Connection* con=NULL;
try{
con=env->createConnection("user","pwd","tnsservice-name");
}

where tnsservice-name is the name I specified in the tnsnams.ora, and which I used with the other tools working fine -> same error.My username is only 4 long, so I thought it might have something to do with the string. So I tried:

Environment* env=Environment::createEnvironment(Environment::DEFAULT);
Connection* con=NULL;
string user="user";
string passwd="pwd";
string db="tnsservice-name";
try{
con=env->createConnection(user,passwd,db);
AfxMessageBox("sucess");
}

now it returned the error "TNS:connect descriptor too long". Can't have anything to do with the .ora file, since it worked fine for the other tools. Plus it didn't matter if I renamed the .ora file or removed it from the TNS_ADMIN directory..So I searched a little more for a solution and so an example, where the the last argument is missing. So I tried

string user="user";
string pwd="pwd";
Environment* env=Environment::createEnvironment(Environment::DEFAULT);
Connection* con=NULL;
try{
con=env->createConnection(user,pwd);
}

It returns: "TNS: protocol Adapter error" which I somehow can understand, since the adapter doesn't know to wich db to connect.I also tried to use some frameworks like soci or otl but was never able to compile them... (link errors, unknown data types etc...).

View 1 Replies View Related

Precompilers, OCI & OCCI :: C++ Migrated From 32 Bit To 64 Bit / Getting Unrelated Sqlcode While Dealing With Oracle Database

Feb 22, 2013

Previously we had 32 bit C++. Now, we have migrated it to 64 bit. And our C++ programs interact with Oracle 10g DB.Our C++ program was working fine with 32 bit. But once after we migrate to 64 bit we are facing problem with one program which does FETCH(EXEC SQL FETCH SUBP1 INTO :new TabRec;) from Oracle DB. ie, We exit from a for loop in the C++ program when we get NOT FOUND(sqlca.sqlcode=1403) on executing the FETCH statement.

The sqlcode generated for NOT FOUND scenario is 1403. But, once after moving to 64 bit C++, we do not see the sqlcode 1403 instead we are seeing a different code 7124089117159473.

As the sqlcode is not 1403, our program does not exit from the for loop and goes on an infinite loop.Am I missing anything that makes me to not get the exact sqlcode?

View 9 Replies View Related

Precompilers, OCI & OCCI :: EXEC SELECT Query Not Fetching Record Even Though It Is Present In Database

Jun 26, 2008

I am using Pro*C/C++ Release 10.2.0.2 in HP-UX. But Pro*C/C++ application was written long back during oracle release 8. Now we are facing a problem like EXEC SELECT query is not fetching the records even though record is present in DATABASE.

This is not happening every time. This problem starts happening only after heavy use of the unix process.

For every request, unix process will fetch the record and updates the same at the end and process goes to wait mode to get the request again. Let say after 50 request, process is returned with no rows found error.

It started working fine only after restarting the process and problem starts again after 50th or 60th request. This problem we are facing only after upgrade to 10g.

View 1 Replies View Related

Data Guard :: 12514 - Error Received Logging On To Standby?

Jul 31, 2013

. I need to configure simple standby database. I have followed this[URL]...-guard-setup-11gr2.php tutorial to do that Problem is that primary db cannot log on to the standby db. Informations privided below

:Primary DB:CentOS 6.4Oracle 11gR2ORACLE_SID=primdb1SQL> SELECT MESSAGE FROM V$DATAGUARD_STATUS; MESSAGE--------------------------------------------------------------------------------ARC0: Archival startedARC1: Archival startedARC2: Archival startedARC1: Becoming the 'no FAL' ARCHARC1: Becoming the 'no SRL' ARCHARC2: Becoming the heartbeat ARCHARC1: Beginning to archive thread 1 sequence 31 (336165-356856)Error 12514 received logging on to the standbyPING[ARC2]: Heartbeat failed to connect to standby 'stbydb1'. Error is 12514.ARC1: Completed archiving thread 1 sequence 31 (336165-

[code]....

View 21 Replies View Related

PL/SQL :: How To Update Null Data With Previous Not Null Data

Oct 25, 2012

Initially i have inserted the data into table like

Date                   xxx       yyyy
1/1/12 1 1
2/1/12 null null
3/1/12 null null
4/1/12 1 1
5/1/12 1 1
6/1/12 null null

in above example data is null for some date here my requirement is how can i copy before not null data(1/1/12) to *2/1/12, 3/1/12* .

View 3 Replies View Related

Data Guard :: Sudden Lost To A Standby Box

Mar 24, 2011

While i'm trying some of fail over and switch over scenario's on my primary and standby db configuration. But suddenly i completely loss my standby db box, due to hardware failure. so now i'm not able to recover that box. It is almost non recoverable hardware failure to that box. My primary db is still up and running well. When i check the alert logs of primary db it has some errors related to standby db. Due to configuration it tries to sync the standby db, which is not possible to connect anymore. So my main question is how get rid of that errors/stop that errors from primary db. which parameter's i've to turn off in primary db. Herewith i'm giving some of initSID parameter of Primary db and a snap of alert log from primary db.

My primary db is in MAXIMUM AVAILABILITY mode. Snap from alert files

Errors in file /ora9isoft/odb/OH1/admin/wbdata/bdump/wbdata_lgwr_1248.trc:
ORA-12541: TNS:no listener
******************************************************************
LGWR: Setting 'active' archival for destination LOG_ARCHIVE_DEST_2
******************************************************************
Creating archive destination LOG_ARCHIVE_DEST_2: 'wbdata.wbhouse'
LGWR: Transmitting activation ID a043c21d
[code]....

View 9 Replies View Related

Precompilers, OCI & OCCI :: PRO*C Compiler Version Versus Database Version

Oct 15, 2010

We are planning to upgrade a database from 9.2.0.8.0 to 10.2.0.4.0.We have a lot a PRO*C programs pre compiled using 9.2.0.8.0 (and most likely even 9.2.0.7.0) compiler.

if we could upgrade the database without having to re-compile all the programs.We have tested this approach against some of our programs. Most of them executed fine - but in 2 cases we are getting "ORA-01001 invalid cursor". I suspect, that the case is that Pre compiler version 9 is not supported against 10g databases - but I am not sure.

Would it be a better option to upgrade Pre compiler/client as the first step and the db as the second step (and would that be supported) ? We definitely don't want to upgrade both Pre compiler/Client and the Database in one goal - that would be too risky.

View 3 Replies View Related

Backup & Recovery :: Protect / Recover Data If Lost

Jan 9, 2013

how to take backup and recover of oracle database and which method is best for to protect our data from lost

View 3 Replies View Related

Copy Data From One Field (varchar) To Another Within A Table

Oct 5, 2010

i have a table COLOR having alphanumeric fields i.e Color Description & Color Ref. i want to copy the values from Color Description to Color Ref.

what will the select statement for this?

View 9 Replies View Related

SQL & PL/SQL :: Get Numeric Values From A Column Of Varchar Data?

Aug 16, 2013

I have a table and data like mentioned below.

create table emp( ename varchar2(20));
insert into emp values ('122');
insert into emp values ('abc');
insert into emp values ('0.2');
insert into emp values ('0-5');
insert into emp values ('25-30');

SQL> Select * from emp;
| ENAME |
-------------------
| 122 |
| abc |
| 0.2 |
| 0-5 |
| 25-30 |

I am running the code

SQL>select regexp_substr(ename , '^[[:digit:]]+.[[:digit:]]+$|^[[:digit:]]+$')
from emp;

AFTER RUNNING I AM GETTING THIS

| REGEXP_SUBSTR(ENAME,'^[[:DIGIT:]]+.[[:DIGIT:]]+$|^[[:DIGIT:]]+$') |
---------------------------------------------------------------------
| 122 |
| (null) |
| 0.2 |
| 0-5 |
| 25-30 |
| (null) |

Why it's not excluding '0-5' and '25-30', how I should write code to exclude this and Is there is any function in oracle to check for numeric in column and print.

View 4 Replies View Related

SQL & PL/SQL :: Converting BLOB Data To Long Or Varchar

Feb 6, 2013

converting BLOB data into varchar2 or long .

we have function which convert long data and return it has varchar . But has part of Apps upgrade the Column has been converted into blob column.

How we need the same function to read the data from BLOB and return its as long or varchar2.

Somewhere i am making mistake..

CREATE OR REPLACE function GDS.test_alert_msg(v_rowid rowid) return varchar2 is

vblob blob;
i2 number;
amt number :=32767;
len number;
pos raw(32767);
position INTEGER := 10000;
my_vr raw(32767);

[Code]....

View 2 Replies View Related

SQL & PL/SQL :: Convert Clob To Varchar Data Type

Aug 16, 2012

I want to convert a clob datatype to varchar data type.I have a clob data type in the below format.

-----------------------------------------------------------------------------------------
<HTML><HEAD><TITLE>Tata Communications Limited</TITLE><BODY leftMargin=20 topMargin=10 rightMargin=20 marginheight=10 marginwidth=10><Table border="0" cellpadding="0" cellspacing="0"
-----------------------------------------------------

I want to insert all the values into varchar datatype.provide the sample code how to convert.

View 1 Replies View Related

Precompilers, OCI & OCCI :: Connectivity Between C And Oracle?

Aug 12, 2008

Is it possible to connect with Oracle using C?

View 2 Replies View Related

Precompilers, OCI & OCCI :: Keep Getting ORA-22275 From Extproc?

Sep 26, 2012

I am trying to give back data from a stored procedure written in C. I registered the functions as follows:create or replace procedure version(versioninfo OUT clob) as external name "version" library myLib language c with context parameters (context, versioninfo, versioninfo INDICATOR SB4); It compiles fine. The function being called look like this:

extern "C" DLLEXPORT
void version(OCIExtProcContext* context, OCILobLocator **out, sb4 *ind_out){
OCIEnv* envh;
OCISvcCtx* svch;
OCIError* errh;
OCIExtProcGetEnv (context, &envh, &svch, &errh);

std::string versioninfo = "104";
oraub8 maxChar = 10;

[code]...

If I execute the procedure with SQLDeveloper by pressing "play" it is getting executed but there is no result. If I try to execute it from an anonymous block it results in ORA-22275 instead of doing anything.

declare
res clob;
begin
-- the following doesn't work much
--dbms_lob.createtemporary(res,true);
version(res);
dbms_output.put_line(res);
end;

Actually I have to questions:
1.) Why does Oracle give me the error? In my opinion all requirements mentioned by the error description are met.
2.) Why is there no output when executing the function via SQL Developer? Is the usage of OCILobWrite wrong?

View 2 Replies View Related

Precompilers, OCI & OCCI :: Describe STP In Package

Nov 26, 2009

I am trying to describe an STP in a package, but it gives me an error.

e.g. In package ABC suppose there is an STP XYZ, I am trying to describe ABC.XYZ function but it gives me an error code 4043 and error message object XYZ.ABC does not exist.

View 2 Replies View Related

Precompilers, OCI & OCCI :: 11g Pro*C Application Crashes While 10g Is OK

Jan 24, 2009

My 10g pro*c application works perfectly, recently I upgraded it to 11g, but it keep crashing, why?

View 10 Replies View Related

Precompilers, OCI & OCCI :: Proc Compilation?

Mar 31, 2010

i need to compile a proc program, say prog.pc.have oracle 10g in my system. Since i am new to proc programming, me on the steps to compile the proc program in oracle proc compiler.

View 2 Replies View Related

Precompilers, OCI & OCCI :: How To Get Columns As NUMBER(30)

Aug 13, 2008

in my oci applications,if i get a column of number that is in the scope of int,i can use value = *(int *)field.data; get the value,but if the column size is larger than 10,the code can't be available,how can i get the value.

View 6 Replies View Related

Precompilers, OCI & OCCI :: Calling Procedure From PRO C?

Nov 26, 2012

I am trying to call procedure from PRO C Procedure has many parameters and I do not need to put all of them when I call procedure. Is there way to make the same way as in PL/SQL

like this

my_procedure( q=>a1 , b=>'abc )

View 1 Replies View Related

Precompilers, OCI & OCCI :: How To Connect To Two Databases

Aug 25, 2009

My program needs to connect to two databases and make operations in both databases:

Quote:connect to db1;
connect to db2;

select from table in db1;
update table in db2;

i would like to know whether it's possible, and how to do it ? how to specify for each query the database connection to use?

note that I can't use dblinks as i don't have enough access rights and privileges on neither of the databases.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved