Precompilers, OCI & OCCI :: Insert Multiple Rows Using Array Bind Feature?

Aug 18, 2010

I am trying to insert multiple rows using array bind feature.

The following is working fine & inserting rows as expected.

char values[3][2] = { "1", "2", "3" };
ub2 lenp[3];
lenp[0] = lenp[1] = lenp[2] = 2;

[Code]...

OCIStmtExecute() is failing with the following error

Error - ORA-01480: trailing null missing from STR bind value

View 1 Replies


ADVERTISEMENT

Precompilers, OCI & OCCI :: Using Pointer To Structure For Selecting Multiple Rows From Table

May 11, 2010

I am working on Pro*C and i have a requirement where i need to select all the rows from a table into a c - structure variable. Since i get to know the no of rows in the table which is getting selected only at run time, i need to create a pointer variable to the structure and i'll allocate the size to it based on the count of rows in the table using malloc or calloc.I tried allocating memory using calloc and it does not show any error. But when i when the exec select statement run it shows an error.

Statements i have used:
struct common *comp;
struct common_ind *comp_i;

comp = (struct common*) calloc(rowcount, sizeof(struct common));
comp_i = (struct common_ind*) calloc(rowcount, sizeof(struct common_ind));

exec sql at db1 select * into :comp indicator :comp_i from tab1;

Error i get :

Stop Error: -2112
Stop Error: -1012
Stop Error: -1012

View 2 Replies View Related

Precompilers, OCI & OCCI :: Bind Variables API Obndrv()?

Apr 21, 2009

can i have some real time code piece for bind variables steps and obndrv(...)

View 1 Replies View Related

Precompilers, OCI & OCCI :: Receiving Records Of Table In Array Of Structure

Mar 12, 2009

sample code in OCI in C for receiving records of table in array of structure? Or dynamically storing the result-set in an array..using array of pointers to structure..

View 6 Replies View Related

Precompilers, OCI & OCCI :: How To Pass Array Of Strings To And Return Table Set From Proc

Jan 24, 2011

I have to write a PL/SQL procedure, which is supposed to take an array of strings as input. This array will have simple strings as elements, like

'000887S','000780S'.

Now I have a query in the procedure, which will return a row, for each of the array elements. For example:

SELECT
su.EMPLOYEE_ID,su.FIRST_NAME,
su.LAST_NAME
FROM
USERS su,
[code]......

In the place of the '?' in the above query, the array elements have to be passed. So we will get one row from the above query for each array element.

Now we either have to loop through the array elements to fetch the result set for the above query for each array element, or we can use some other method too. Our objective is to collect all the rows of the above query for each array element as a table data and this procedure has to return this table set.

what will be the best way to pass such a set of data to the proc and best way for the proc to return this result set. Like we can use arrays, table type data,ref cursors, etc.

View 1 Replies View Related

Precompilers, OCI & OCCI :: Passing Array Of Structure To Oracle Procedure And Returning Back?

Apr 29, 2010

I created a table and some type definitions in oracle 10.2.0.3 DB as follows. There is also a procedure that I defined and is shown below.

SQL> create table test_proc
(
test_name varchar2(10),
test_ver number (3,3),
active_flag number(2)
);

Table created.

SQL> select * from test_proc;
TEST_NAME TEST_VER ACTIVE_FLAG
---------- ---------- -----------
AFP 1.5 2
PSA 11.89 0
EHIV 99.5 3
aHAVM 1.45 9

[code]....

Now from Pro*C function I want to pass a similar array of structure to this procedure and return it via the out parameter of the procedure back to Pro*C. How do I do it?

I am using the attached program but its giving me compiler error as follows..

Error at line 31, column 1 in file sample.pc
proc_modify_tdefs (:in_tdefs,:out_tdefs);
1
PLS-S-00306, wrong number or types of arguments in call to 'PROC_MODIFY_TDEFS'
Error at line 31, column 1 in file sample.pc
proc_modify_tdefs (:in_tdefs,:out_tdefs);

[code]....

View 2 Replies View Related

Precompilers, OCI & OCCI :: Pro*C - Cursor Leak With Cursor Array

Sep 7, 2007

I'm dealing with an ORA-1000 error in a Pro*C application where all the cursors are correctly closed (or so it seems to me).

Here is the code for a simple program which reproduces the problem:

Each cursor is opened in a PL/SQL package:

CREATE OR REPLACE PACKAGE emp_demo_pkg AS
TYPE emp_cur_type IS REF CURSOR;
PROCEDURE open_cur(curs IN OUT emp_cur_type, dept_num IN NUMBER);
END emp_demo_pkg;

[Code]....

While testing the initialization parameter open_cursors is set to 50.

It's my understanding that Oracle doesn't close the cursors until it needs the space for another cursor, which in my test case seems to happen when I enter a value of 50 or bigger for "number of loops". To see how oracle is reusing the cursors, while the test program is running I run SQL*Plus and query v$sesstat for the session that's running the test with the following sentence:

select name, value
from v$sesstat s, v$statname n
where s.statistic# = n.statistic#
and sid = 7
and name like '%cursor%';

Even before I enter a value for number of loops I can see that the session opened 4 cursors and closed 2 of them:

NAME VALUE
---------------------------------------------------------------- ----------
opened cursors cumulative 4
opened cursors current 2

Entering a value of 5 for number of loops yields

NAME VALUE
---------------------------------------------------------------- ----------
opened cursors cumulative 11 <----- 7+
opened cursors current 8 <----- 6+

With a value of 30

NAME VALUE
---------------------------------------------------------------- ----------
opened cursors cumulative 36 <----- 25+ (apparently, Oracle reused at least 5 cursors)
opened cursors current 33 <----- 25+

With a value of 47

NAME VALUE
---------------------------------------------------------------- ----------
opened cursors cumulative 53 <----- 17+
opened cursors current 50 <----- 17+

Now I reached the upper limit set by the initialization parameter open_cursors.

Entering a value of 48, I get the ORA-1000 error.

ORA-01000: maximum open cursors exceeded
ORA-06512: at "SCOTT.EMP_DEMO

Since I open and close the cursor in the same loop iteration, I expect to find in every iterarion 1 explicit cursor and a number of implicit cursors (the PL/SQL call along with the so-called recursive cursors), but I don't expect the sum of all of them to be greater than 50. If my understanding is correct Oracle should be reusing the 50 cursors previously marked as "closeable", not raising the ORA-1000 error.

View 1 Replies View Related

Precompilers, OCI & OCCI :: Errors During Insert Operation In Pro*C?

Apr 13, 2009

I am receiving the following error while inserting records.

"Oracle Error:ORA-12899: value too large for column "MFG_ADMIN"."GAGE_RESULTS"."COMP

whereas I am checking the length of all values before inserting and am sure that none of them are larger than column lengths.I did some research and found this error might be due to character set.

select * from nls_database_parameters where parameter like '%CHARACTERSET';

PARAMETER VALUE
------------------------------
----------------------------------------------------------------------------------------------------
--------------------
NLS_CHARACTERSET UTF8
NLS_NCHAR_CHARACTERSET UTF8

how can this be related to my problem or if something else is causing this error.

View 3 Replies View Related

Precompilers, OCI & OCCI :: Bulk Insert To Stored Procedure?

May 12, 2009

I have an array of C structs say

struct S
{
int a, long b, double c;
};
S s[100];

Further suppose I have an Oracle table T like this:

create table T
(
a number(10),
b number(10),
c float
);

I want to bulk insert all 100 instances of S from a client application into T. I've seen code that does this for *one* field or column. The code defines a stored procedure which accepts a single argument which is a TABLE and then does a FORALL ... insert. The client application passes in the array of data.

What I need is N columns. In my example above struct S has N=3 fields which conform to the N=3 columns in T. In reality my N will be 50+. I am trying to avoid creating stored procedures which will take the 50 or so arguments it will eventually need.

So does my stored procedure need to accept N TABLE arguments? Or can I cajole OCI/OTL/ODBC and PL/SQL so that the stored procedure can take an array of rows which the type of row conforms to T by defining a record or something? That is, do I need:

Option 1: // declares one type and one argument each for N cols
create or replace procedure insert_S(
a_array IN A_TABLE, -- type A_TABLE is TABLE of number;
b_array IN B_TABLE, -- type B_TABLE is TABLE of number;
c_array IN C_TABLE) -- type C_TABLE is ...
begin ... end

Option 2: // this somehow accepts an array compatible with T
// if I could get a OCI/OCCI/OTL/ODBC application
// to send this data, this procedure would have
// only one argument
create or replace procedure insert_S(
row_array IN ?????????? type -- some sort of array of rows
)
begin ... end

Or should I pass the whole memory chunk of data in as an image or varchar array -- basically an opaque block of data -- and then internally decypher/decode the memory block inside the stored procedure as discussed on [URL].

best way to pass an array of N C-structs of M fields to a stored procedure for insertion into a table with M compatible columns? One TABLE per column? with an array of a custom type compatible with a row in T? As glob of data? Another option is to populate some host variables ... but, again, I'd need N host variables.

View 1 Replies View Related

Precompilers / OCI & OCCI :: Connection Pooling Over Multiple Processes

Dec 9, 2009

We are currently using OCI to connect to Oracle DB using c language. Each process has its own dedicated Connection and Env handle, session handle ...

Right now we decided to use Connection Pooling. In the documentation , Connection pooling examples were using multi-threaded environment. But in our case its multi-process system and we cant modify products architecture to multi-thread.

I would like to know how we can use Connection Pooling on multiple processes.

View 2 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 :: How To Fetch All Rows In A Cursor In Local Variables

Jul 29, 2008

How to fetch all the rows in a cursor in local variables(host variables) in PRO C . /*For x in cur is not working....*/

View 2 Replies View Related

SQL & PL/SQL :: How To Hold Multiple Rows Values Using Array

Jun 1, 2010

How to hold the multiple rows values using array? And I have to pass this values to some other procedure.

Ex: SQL> select ename from emp;

ENAME
----------------------
Vetrivel
Dr.Venkat
Vinoth
Sudhakar
Sivaganesh
Senthil

View 7 Replies View Related

PL/SQL :: ORA-06502 Numeric Or Value Error / Host Bind Array Too Small

Sep 25, 2012

While running by run script to perform few DMLs - im getting the ORA-06502 - PL/SQL:numeric or value error: host bind array too small.i ve put the server output off and then ON to clear the cache.Still same issue.

View 6 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

Precompilers, OCI & OCCI :: How To Report Oracle Bug

Jan 30, 2009

How to report an Oracle bug? Is there webpage or email?

View 4 Replies View Related

Precompilers, OCI & OCCI :: How To Connect C++ And Oracle

Sep 17, 2008

My OS is Linux and I installed Oracle 10.2. Everything is fine.I can use sqlplus, exp, imp etc with no problem.Now I have created another linux user test in /home/test. I unzipped basic-10.2xxxxxx.zip (/home/test/instantclient_10_2) and exported LD_LIBRARY_PATH.I guess I have installed instant client in this way.

My testOra.cpp:

#include <occi.h>
int main()
{
return 0;
}

This test.cpp would not compile. It cannot find occi.

View 8 Replies View Related

Precompilers, OCI & OCCI :: Using Cursor In Pro Cobol

Oct 7, 2010

I declare a cursor for a table with 8000 records, when I fetch the cursor this message appear ORA-03113: end-of-file on communication channels when the fetch reach the 6500 element, What is the problem here?. All data are ok, not null fields.

other problem

How I can reuse a cursor, I declare a cursor for a table where code_part = 300, then I fetch all elements until end cursor, then I close the cursor, Then I declare the same cursor again for the same table where code_part = 359, but it is not successful, when I tried to fetch the cursor again the cobol program show me the last record for the first code, How I can restart the cursor or delete it or freed the cursor position?

View 1 Replies View Related

Precompilers, OCI & OCCI :: Print Run Time Value?

Apr 26, 2012

I am inserting empno in a table1 and updating another table2 using table1 empno and getting ora-01427 error. I want to print empno for whis this error is coming. How to print that value?

View 1 Replies View Related

Precompilers, OCI & OCCI :: Convert C To PC File?

Dec 11, 2010

Can i convert a .c file to .pc file?The .c file is generated by compiling .pc file. I mistakenly deleted the .pc file. I need the original .pc file.

View 2 Replies View Related

Precompilers, OCI & OCCI :: How To Integrate SQLnet

Apr 17, 2009

how to integrate SQLnet & c and I'm quite losted at the moment.

Searching with google gives some random stuff, which does seems to be irrelevant.some oracle db somewhere and need for good way to use that remote db (one solution seems to be using SQLnet).

View 1 Replies View Related

Precompilers, OCI & OCCI :: Indicator Values For DATES

Jun 1, 2010

If doing an insert into DATE type fields like below... how do I employ null indicator values with the TO_DATE sql to cope with NULL values for the End Date? I can test the NULLness of the pServiceRecord->itemTo value and set the indicator ind_dbToDate to -1 but I don't know how to incorporate this with the to_date syntax (if I can)?

EXEC SQL BEGIN DECLARE SECTION;
char dbFromDate[MAX_DATE_LEN];
char dbToDate[MAX_DATE_LEN];
short ind_dbToDate;
[code]...

View 2 Replies View Related

Precompilers, OCI & OCCI :: Using Distributed Transactions With ProC

Jul 7, 2011

I found this thread, and recently i want to embedded oci in pro*c for distributed transaction reason.

can pro*c deal with distributed transaction? i want to use mts in pro*c .

View 14 Replies View Related







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