oracle-pro-c

Interaction of SELECT FOR UPDATE lock with cursor and batch DML

余生长醉 提交于 2020-01-06 04:52:14
问题 Currently my code skeleton looks like: varchar rowidvariable[batchlimitcount][19]; stmt = "Select rowid from table_name where xx" delstmt = "delete from table_name where rowid=:rowidvariable" prepare delstatement using delstmt; prepare cursor from stmt; declare cursor from preparecursor; open cursor; while(1) { fetch cursor into rowidvariable; somecondition {break}; exec sql for fetchedCount execute delstatement using :rowidvariable; commit; } It was pointed out to me that locking the table

Whether performance will impact when database procedure is called from application many times?

▼魔方 西西 提交于 2020-01-06 03:11:09
问题 In my project, we are calling the oracle procedure from our c++ application with the help of Pro *C/C++ library provided by the oracle. We have one big procedure, and my idea is to split the procedure in to two for modularity. But their advice is to call the procedure for one time, and perform all jobs at a shot. The reason which i got from them is it will cause performance impacts, since application program is interacting with database for multiple times. I agree, the above scenario will

Oracle ProC INSERT INTO VALUES ( (select …) )

别等时光非礼了梦想. 提交于 2019-12-24 01:54:27
问题 Running Pro*C on Oracle 10g. I am looking to do a subquery within an insert statement values clause. This sql query is fully valid and runs within TOAD with no problems, but Pro*C fails to parse the query. EXEC SQL INSERT INTO TARGET_ATTACHMENT ( TARGET_ID FILENAME ) VALUES ( :targetID, ( SELECT CREATED_FLAG from TARGET t where t.TARGET_ID = :targetID ) || '.tif' ) If I remove: ( SELECT (CREATED_FLAG || DISPLAY_ID) from TARGET t where t.TARGET_ID = :targetID ) ||**". The Pro*C compiler works

How to specify a variable expression list in a Pro*C query?

烈酒焚心 提交于 2019-12-20 06:36:58
问题 I have a problem with a Pro*C query I'm trying to optimise. To explain, our application searches for rows in a huge database. These rows exist in several languages and the old code selected a row for each language in an array. Now as these queries are the most time consuming part of our app, I wanted to make only one query which writes directly in an array. The language codes are 2 letter ISO-639 codes (en for english, fr for french). Old way (this is only a simplified code to show the

system() returns -1, errno=10 when logged into Oracle

北城以北 提交于 2019-12-20 02:56:45
问题 After an EXEC SQL CONNECT user/pass; command, system("") returns a -1 with errno=10. We've migrated this program from Oracle 10g on HP-UX to Oracle 11g on Red Hat Linux. This was not happening on HP-UX / Oracle 10g. #include <errno.h> #include <dirent.h> #include <sys/types.h> #include <time.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <signal.h> #include <sys/stat.h> typedef char vc2[10]; typedef char vc4[20]; EXEC SQL INCLUDE sqlca; char *oracleid = "user/pass";

Oracle Pro*C Bulk Merge of records in C using host arrays degrading performance with increased volume

≡放荡痞女 提交于 2019-12-12 06:31:54
问题 Using Oracle 11g Pro*C in C, I am using host arrays for managing bulk merge into DB table as per following example: merge into TBL_NM A using (select 1 from dual) B on (col1 = to_date(:v,'YYMMDD') and col2 = :v and col3 = :v and col4 = :v) when matched then update set col5 = :v, col2 = col2+ :v, col3 = col3 + :v when not matched then insert (col1, col2, col3, col4, col5, col6, col7, col8) values (to_date(:v,'YYMMDD'),:v,:v,:v,:v,:v,:v,:v) My first Question is: whether this way of bulk merge

When do a PREPARE QUERY fails in PRO C?

旧街凉风 提交于 2019-12-12 04:26:00
问题 When do a PREPARE QUERY fails in PRO C? EXEC SQL AT :db_id PREPARE QUERY FROM :sql_query; bool sql_status = (sqlca.sqlcode == OERR_ORACLE_SUCCESS); if (sql_status) { } else { } I don't have this problem until recently, The code was working fine the PREPARE QUERY is working fine (going into if loop_, but all of a sudden it failed, and is not working after that (going into else loop). Nothing has changed and it's the same binary. Does anybody face a similar problem in the past? 回答1: I've

Strange Cursor behavior while declaring same cursor multiple times

浪子不回头ぞ 提交于 2019-12-11 16:05:42
问题 Usually when I declare a cursor with a query which fetches no records: EXEC SQL Declare abcd Cursor For Select 'A' abc from dual where 1=2 the return sqlca.sqlcode is 0. So I have a cursor in a function which is being called multiple times. Sometimes it fetches records & sometimes it doesn't depending on the process phase, however in certain cases the declare cursor is throwing the below error & in most of the cases it passes successfully: Code [1403], Error Message: [ORA-01403: no data found

Multiple dynamic values in a Pro *C query IN clause

放肆的年华 提交于 2019-12-11 11:42:43
问题 I want to read a flat file to fetch a dynamic list of values (number of values is not fixed) & then I want to use this list of values in the IN clause of an select query in Pro *C. What is the best way to achieve this using Pro *C? I came across a few useful articles here & here but I just want to check if there is a more suited solution to my use case. It will be also useful to weigh the pros and cons of options that I might have. Just to give an example, the following is the query: SELECT

PCC-S-02015, unable to open include file

蹲街弑〆低调 提交于 2019-12-11 10:23:16
问题 I am trying to compile a C++ application on SUN server using the compiler Sun C++ 5.9 SunOS_sparc Patch 124863-01. It seems that the Pro*C++ compiler is not able to identify some system header files like vector , list ... I am new to C++ and I am wondering if the compiler could not find the header file itself, or it cannot identify it since it was specified without .h extension. I checked also the pcscfg.cfg configuration file (below) which should point to the system header files for pro*C