Embedded SQL
Hi there,
Want things do I need to run COBOL programs embedded with SQL codes to intereact with Oracle. Please tell me the things which I need to install and give me some steps in executing a COBOL programs. Thanks in advance.
-Aqueel.
The Fine Manual: Pro*COBOL Precompiler Programmer's Guide, Release 9.2, Part Number A96109-01
Similar Messages
-
Can window and aggregate SQL functions used in Pro*C embedded SQL?
It appears that the window functions such as dense_rank() over(partition by ... order by ...) are not available in Pro*C embedded SQL. Can somebody please confirm that that is really the case?
Thanks
Rawender GuronPlease refer to this thread: "Is this forum also used for Pro*'C Questions? "
Is this forum also used for Pro*'C Questions? -
PRO*C에서 EMBEDDED SQL STATEMENTS를 사용해서 LOB DATATYPES에 접근하는 예제
제품 : PRECOMPILERS
작성날짜 : 2001-07-12
PRO*C에서 EMBEDDED SQL STATEMENTS를 사용해서 LOB DATATYPES에 접근하는 예제
==========================================================================
Pro*C에서 LOB를 사용하는 방법에는 다음 3가지가 있습니다.
(1) PL/SQL blocks에서 DBMS_LOB package를 이용하는 방법
(2) OCI function을 이용하는 방법
(3) Embedded SQL statements을 이용하는 방법
다음은 (3)번째 방법에 대한 pro*c에서 지원하는 명령어들입니다.
o APPEND: Appends lob value at the end of another LOB.
EXEC SQL LOB APPEND :src TO :dst;
o ASSIGN: Assigns LOB or BFILE locator to another.
EXEC SQL LOB ASSIGN :src TO :dst;
o CLOSE: Close LOB or BFILE.
EXEC SQL LOB CLOSE :src;
o COPY: Copy all or part of LOB value into another LOB.
EXEC SQL LOB COPY :amt FROM :src [AT :src_offset] TO :dst [AT dst_offset];
o CREATE TEMPORARY: Creates a temporary LOB.
EXEC SQL LOB CREATE TEMPORARY :src;
o ERASE: Erase the given amount of LOB data starting from a given offset.
EXEC SQL LOB ERASE :amt FROM :src [AT :src_offset];
o FILE CLOSE ALL: Closes all the BFILES open in the current session.
EXEC SQL LOB FILE CLOSE ALL;
o FILE SET: Set DIRECTORY alias and FILENAME in a BFILE locator.
EXEC SQL LOB FILE SET :file DIRECTORY = :alias, FILENAME = :filename;
o FREE TEMPORARY: Free the temporary space for the LOB locator.
EXEC SQL LOB FREE TEMPORARY :src
o LOAD FROM FILE: Copy all or part of BFIL into an internal LOB.
EXEC SQL LOB LOAD :amt FROM FILE :file [AT :src_offset]
INTO :dst [AT :dst_offset];
o OPEN: Open a LOB or BFILE for read or read/write.
EXEC SQL LOB OPEN :src [ READ ONLY | READ WRITE ];
o READ: Reads all or part of LOB or BFILE into a buffer.
EXEC SQL LOB READ :amt FROM :src [AT :src_offset]
INTO :buffer [WITH LENGTH :buffer];
o TRIM: Truncates the LOB vlaue.
EXEC SQL LOB TRIM :src to :newlen;
o WRITE: Writes contents of the buffer to a LOB.
EXEC SQL LOB WRITE [APPEND] [FIRST | NEXT | LAST | ONE ]
:amt FROM :buffer [WITH LENGTH :buflen] INTO :dst [AT :dst_offset];
o DESCRIBE: Retrieves the attributes from a LOB.
EXEC SQL LOB DESCRIBE :src GET attribute1 [{, attributeN}]
INTO :hv1 [[INDICATOR] :hv_ind1] [{, :hvN [[INDICATOR] :hv_indN] }];
Attributes can be any of the following:
CHUNKSIZE: chunk size used to store the LOB value
DIRECTORY: name of the DIRECTORY alias for BFILE
FILEEXISTS: whether BFILE exists or not
FILENAME: BFILE name
ISOPEN: whether BFILE with this locate is OPEN or not
ISTEMPORARY: whether specified LOB is temporary or not
LENGTH: Length of BLOBs and BFILE in bytes, CLOBs and NCLOBs
in characters.
다음은 LOB를 사용하는 sample을 실행하는 방법입니다.
1. 먼저 scott user에서 다음을 실행합니다. (create directory를 할 수 있는 권한이
있어야 하며, directory는 사용하시는 환경에 맞도록 수정해 주십시요.)
drop table lob_table;
create table lob_table (key number, a_blob BLOB, a_clob CLOB);
drop table lobdemo;
create table lobdemo (key number, a_blob BLOB, a_bfile BFILE);
drop directory dir_alias;
create directory dir_alias as '/users/app/oracle/product/8.1.7/precomp/demo/proc';
insert into lob_table values(1, utl_raw.cast_to_raw('1111111111'), 'aaaaaaaa');
commit;
2. 다음 코드는 out.gif 파일을 위에서 지정한 directory에 만들고 lob_table의
내용에 들어있는 BLOB의 내용을 저장하는 sample입니다.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sqlda.h>
#include <sqlcpr.h>
/* Define constants for VARCHAR lengths. */
#define UNAME_LEN 20
#define PWD_LEN 40
/* Declare variables. No declare section is
needed if MODE=ORACLE. */
VARCHAR username[UNAME_LEN]; /* VARCHAR is an Oracle-supplied struct */
varchar password[PWD_LEN]; /* varchar can be in lower case also. */
/* The following 3 lines avoid inclusion of oci.h during precompilation
oci.h is needed only during compilation to resolve calls generated by
the precompiler
#ifndef ORA_PROC
#include <oci.h>
#endif
#include <sqlca.h>
OCIBlobLocator *blob;
OCIClobLocator *clob;
FILE *fp;
unsigned int amt, offset = 1;
#define MAXBUFLEN 5000
unsigned char buffer[MAXBUFLEN];
EXEC SQL VAR buffer IS RAW(MAXBUFLEN);
/* Declare error handling function. */
void sql_error(msg)
char *msg;
char err_msg[128];
size_t buf_len, msg_len;
EXEC SQL WHENEVER SQLERROR CONTINUE;
printf("\n%s\n", msg);
buf_len = sizeof (err_msg);
sqlglm(err_msg, &buf_len, &msg_len);
printf("%.*s\n", msg_len, err_msg);
EXEC SQL ROLLBACK RELEASE;
exit(EXIT_FAILURE);
void main()
/* Connect to ORACLE--
* Copy the username into the VARCHAR.
strncpy((char *) username.arr, "SCOTT", UNAME_LEN);
/* Set the length component of the VARCHAR. */
username.len =
(unsigned short) strlen((char *) username.arr);
/* Copy the password. */
strncpy((char *) password.arr, "TIGER", PWD_LEN);
password.len =
(unsigned short) strlen((char *) password.arr);
/* Register sql_error() as the error handler. */
EXEC SQL WHENEVER SQLERROR DO sql_error("ORACLE error--\n");
/* Connect to ORACLE. Program will call sql_error()
* if an error occurs when connecting to the default database.
EXEC SQL CONNECT :username IDENTIFIED BY :password;
printf("\nConnected to ORACLE as user: %s\n", username.arr);
/* Allocate the LOB host variables and select the BLOB value */
EXEC SQL ALLOCATE :blob;
EXEC SQL ALLOCATE :clob;
EXEC SQL SELECT a_blob INTO :blob FROM lob_table WHERE key=1;
/* Open external file to which BLOB value should be written */
fp = fopen("out.gif", "w");
EXEC SQL WHENEVER NOT FOUND GOTO end_of_lob;
amt = 5000;
EXEC SQL LOB READ :amt FROM :blob AT :offset INTO :buffer;
fwrite(buffer, MAXBUFLEN, 1, fp);
EXEC SQL WHENEVER NOT FOUND DO break;
/* Use polling method to continue reading the next pieces */
while (TRUE)
EXEC SQL LOB READ :amt FROM :blob INTO :buffer;
fwrite(buffer, MAXBUFLEN, 1, fp);
end_of_lob:
fwrite(buffer, amt, 1, fp);
printf("\nG'day.\n\n\n");
/* Disconnect from ORACLE. */
EXEC SQL ROLLBACK WORK RELEASE;
exit(EXIT_SUCCESS);
3. 다음 코드는 위에서 만든 out.gif file을 lobdemo에 저장하는 sample입니다.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sqlda.h>
#include <sqlcpr.h>
/* Define constants for VARCHAR lengths. */
#define UNAME_LEN 20
#define PWD_LEN 40
/* Declare variables. No declare section is
needed if MODE=ORACLE. */
VARCHAR username[UNAME_LEN]; /* VARCHAR is an Oracle-supplied struct */
varchar password[PWD_LEN]; /* varchar can be in lower case also. */
/* The following 3 lines avoid inclusion of oci.h during precompilation
oci.h is needed only during compilation to resolve call generated by
the precompiler
#ifndef ORA_PROC
#include <oci.h>
#endif
#include <sqlca.h>
OCIBlobLocator *blob;
OCIBFileLocator *bfile;
char *alias = "DIR_ALIAS";
char *filename = "out.gif";
unsigned int amt = 50;
unsigned int filelen;
/* Declare error handling function. */
void sql_error(msg)
char *msg;
char err_msg[128];
size_t buf_len, msg_len;
EXEC SQL WHENEVER SQLERROR CONTINUE;
printf("\n%s\n", msg);
buf_len = sizeof (err_msg);
sqlglm(err_msg, &buf_len, &msg_len);
printf("%.*s\n", msg_len, err_msg);
EXEC SQL ROLLBACK RELEASE;
exit(EXIT_FAILURE);
void main()
/* Connect to ORACLE--
* Copy the username into the VARCHAR.
strncpy((char *) username.arr, "SCOTT", UNAME_LEN);
/* Set the length component of the VARCHAR. */
username.len =
(unsigned short) strlen((char *) username.arr);
/* Copy the password. */
strncpy((char *) password.arr, "TIGER", PWD_LEN);
password.len =
(unsigned short) strlen((char *) password.arr);
/* Register sql_error() as the error handler. */
EXEC SQL WHENEVER SQLERROR DO sql_error("ORACLE error--\n");
/* Connect to ORACLE. Program will call sql_error()
* if an error occurs when connecting to the default database.
EXEC SQL CONNECT :username IDENTIFIED BY :password;
printf("\nConnected to ORACLE as user: %s\n", username.arr);
/* Allocate the LOB locator */
EXEC SQL ALLOCATE :blob;
EXEC SQL ALLOCATE :bfile;
/* Initialize the DIRECTORY alias of the BFILE and FILENAME */
EXEC SQL LOB FILE SET :bfile
DIRECTORY = :alias, FILENAME = :filename;
EXEC SQL INSERT INTO lobdemo values (1, EMPTY_BLOB(), :bfile);
EXEC SQL SELECT a_blob, a_bfile INTO :blob, :bfile FROM lobdemo
WHERE key = 1;
EXEC SQL LOB OPEN :bfile;
/* Get the BFILE length */
EXEC SQL LOB DESCRIBE :bfile
GET LENGTH INTO :filelen;
printf("File length is: %d\n", filelen);
amt = filelen;
/* Read BFILE and write to BLOB */
EXEC SQL LOB LOAD :amt FROM FILE :bfile INTO :blob;
EXEC SQL LOB CLOSE :bfile;
printf("\nG'day.\n\n\n");
/* Disconnect from ORACLE. */
EXEC SQL COMMIT WORK RELEASE;
exit(EXIT_SUCCESS);
4. 다음은 실행한 결과 입니다.
첫번째 sample :
Connected to ORACLE as user: SCOTT
G'day.
두번째 sample :
Connected to ORACLE as user: SCOTT
File length is: 10
G'day. -
Could we use embedded SQL for XML in .pc ?
Hi,
Can we use embedded SQL for XML in .pc ?
<1> assume we have run SQL statements in Oracle9i:
SQL>create table MY_XML_TABLE
(Key1 NUMBER,
Xml_Column SYS.XMLTYPE);
SQL>insert into MY_XML_TABLE(key1, Xml_Column) values
(1, SYS.XMLTYPE.CREATEXML
('<book>
<chapter num="1">
<text>This is the my text</text>
</chapter>
<book>')
<2> Could we directly translate it in .pc as usually:
<outlined, not exactly)
int emp_number = 1;
XML_Data emprec; /* ?????? */
EXEC SQL SELECT M.Xml_Column.GETCLOBVAL() as XML_Data
INTO :emprec INDICATOR :emprec_ind
FROM MY_XML_TABLE M
WHERE Key1 = :emp_number;
Thanks
MJreply by myself.
No problem!!
===============================
int emp_number = 1;
struct emprec{
char feature[1280]
EXEC SQL SELECT M.Xml_Column.GETCLOBVAL() as XML_Data
INTO :emprec INDICATOR :emprec_ind
FROM MY_XML_TABLE M
WHERE Key1 = :emp_number; -
Calling stored procedure from embedded sql
I'm trying to call a stored procedure from embedded sql. I'm following the examples located in
http://download.oracle.com/docs/cd/B19306_01/appdev.102/a96109/pco06pls.htm#i9641
I have the following section in my .pco file before precompiling.
exec sql execute
begin
docs.grant_access_to_all_categories(:p_sam_id);
end;
end-exec.
When running procob on the file with the above code I get the following error.
Error at line 225, column 13 in file pco\docs_stored_procedures.pco
exec sql execute
............1
PCB-S-00576, PLS-201: identifier 'DOCS.GRANT_ACCESS_TO_ALL_CATEGORIES' must be d
eclared
Error at line 225, column 13 in file pco\docs_stored_procedures.pco
exec sql execute
............1
PCB-S-00576, PLS-0: Statement ignored
Any ideas on what I am doing wrong on calling this stored procedure.I get the same error when trying to precompile sample11.pco from the demo directory in the oracle client software.
Error at line 70, column 12 in file sample11.pco
EXEC SQL EXECUTE
...........1
PCB-S-00576, PLS-201: identifier 'EMP_DEMO_PKG.OPEN_CUR' must be declared
Error at line 70, column 12 in file sample11.pco
EXEC SQL EXECUTE
...........1
PCB-S-00576, PLS-0: Statement ignored -
Embedded SQL against Oracle Question
Software: Forte 3.0.J.
Server Platform: HPUX 10.2
Database: Oracle
Problem Description: During the course of development, I ran into a
problem using multiple columns in an sql UPDATE/SET statement. I was trying
to update a.COLUMN_1 and a.COLUMN_2, which constitute part of the primary
key of associative TABLE_A (a). In order for me to make the update, I
needed to use the existing value of a.COLUMN_1 to lookup the new b.COLUMN_1
in TABLE_B (b). Where a.COLUMN_1 = b.RELATED_COLUMN_1, I am able to find
each b.COLUMN_2 that correspond to each a.COLUMN_2.
I was able to resolve the issue by separating the two columns so
that each had it's own select statement. Theoretically, it appears that
this shouldn't work, because the SET statement for a.COLUMN_1 would cause
the a.COLUMN_1 reference in the select statement of a.COLUMN_2 to be
overwritten.
In spite of this, I tried it, and it worked. I would like to
understand why the sql works, and how sql actually executes the statement.
Here is the sql:
UPDATE TABLE_A a
SET a.COLUMN_1 =
(SELECT DISTINCT b1.COLUMN_1
FROM TABLE_B b1
WHERE b1.RELATED_CASE_ID =
a.COLUMN_1 AND
b1.RELATED_COLUMN_TYPE_CD = 'NEPHI'),
a.COLUMN_2=
(SELECT DISTINCT b2.COLUMN_2
FROM TABLE_B b2
WHERE b2.RELATED_COLUMN_1=
a.COLUMN_1 AND
b2.RELATED_COLUMN_TYPE_CD = 'NEPHI' AND
b2.RELATED_COLUMN_2= a.COLUMN_2)
WHERE a.COLUMN_1 = 100
The table structure is as follows:
TABLE_A: (primary keys are bolded) This is an associative table.
Column_1 and Column_2 comprise the pk of one table; Column_3 and Column_4
comprise the pk of another table. Assume that the Column_1 and Column_2
values replacing the original values already exist in the parent table of
which they form the pk).
COLUMN_1
COLUMN_2
COLUMN_3
COLUMN_4
COLUMN_5
TABLE_B: (primary keys are bolded) This is a reference table.
COLUMN_1
COLUMN_2
RELATED_COLUMN_1
RELATED_COLUMN_2
RELATED_COLUMN_TYPE_CD
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>If you do an explain plan or set autotrace on against this update statement,
you'll find that the select operations are actually executed first by Oracle
- I believe because of the nature of the transaction. Thus, no problem.
Brian Wilson
U.S. Bancorp Piper Jaffray
[email protected]
Phone (612) 342-5682
From: David Pettit[SMTP:[email protected]]
Reply To: David Pettit
Sent: Friday, April 30, 1999 1:58 PM
To: '[email protected]'
Subject: Embedded SQL against Oracle Question
Software: Forte 3.0.J.
Server Platform: HPUX 10.2
Database: Oracle
Problem Description: During the course of development, I ran into a
problem using multiple columns in an sql UPDATE/SET statement. I was
trying
to update a.COLUMN_1 and a.COLUMN_2, which constitute part of the primary
key of associative TABLE_A (a). In order for me to make the update, I
needed to use the existing value of a.COLUMN_1 to lookup the new
b.COLUMN_1
in TABLE_B (b). Where a.COLUMN_1 = b.RELATED_COLUMN_1, I am able to find
each b.COLUMN_2 that correspond to each a.COLUMN_2.
I was able to resolve the issue by separating the two columns so
that each had it's own select statement. Theoretically, it appears that
this shouldn't work, because the SET statement for a.COLUMN_1 would cause
the a.COLUMN_1 reference in the select statement of a.COLUMN_2 to be
overwritten.
In spite of this, I tried it, and it worked. I would like to
understand why the sql works, and how sql actually executes the statement.
Here is the sql:
UPDATE TABLE_A a
SET a.COLUMN_1 =
(SELECT DISTINCT b1.COLUMN_1
FROM TABLE_B b1
WHERE b1.RELATED_CASE_ID =
a.COLUMN_1 AND
b1.RELATED_COLUMN_TYPE_CD = 'NEPHI'),
a.COLUMN_2=
(SELECT DISTINCT b2.COLUMN_2
FROM TABLE_B b2
WHERE b2.RELATED_COLUMN_1=
a.COLUMN_1 AND
b2.RELATED_COLUMN_TYPE_CD = 'NEPHI' AND
b2.RELATED_COLUMN_2= a.COLUMN_2)
WHERE a.COLUMN_1 = 100
The table structure is as follows:
TABLE_A: (primary keys are bolded) This is an associative table.
Column_1 and Column_2 comprise the pk of one table; Column_3 and Column_4
comprise the pk of another table. Assume that the Column_1 and Column_2
values replacing the original values already exist in the parent table of
which they form the pk).
COLUMN_1
COLUMN_2
COLUMN_3
COLUMN_4
COLUMN_5
TABLE_B: (primary keys are bolded) This is a reference table.
COLUMN_1
COLUMN_2
RELATED_COLUMN_1
RELATED_COLUMN_2
RELATED_COLUMN_TYPE_CD
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
Nondeposit investment products are not insured by the FDIC, are
not deposits or other obligations of or guaranteed by U.S. Bank
National Association or its affiliates, and involve investment
risks, including possible loss of the principal amount invested.
Past performance does not guarantee future results. We consider
our sources reliable. Accuracy and completeness are not guaranteed.
Information is subject to change. Transactional details should not
be relied on for tax purposes and do not supersede normal trade
confirmations or statements. Messaging outside U.S. jurisdictions
from U.S. Bancorp Piper Jaffray to non-institutional parties is not
intended for solicitation purposes.
Electronic mail sent through the Internet is not secure. We will
not accept time-sensitive, action-oriented messages, transaction
orders, fund transfer instructions or check stop payments
electronically.
If you are not the intended recipient, notify the Sender. This
information is intended only for the person named above and for
the purposes indicated. Do not distribute this message without
written consent of the author. Non-business opinions may not
reflect opinions of U.S. Bancorp Piper Jaffray and its affiliates.
U.S. Bancorp Piper Jaffray and its affiliates reserve the right to
monitor all e-mail.
Securities products and services are offered through
U.S. Bancorp Piper Jaffray Inc., member SIPC and NYSE, Inc.,
a subsidiary of U.S. Bancorp.
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/> -
Use of Pro*C with embedded SQL
Is it possible to reuse existing Pro*C with embedded SQL written for an Oracle 9i database on an Oracle Lite running on Windows CE/PocketPC plattform? Wich steps and tools are required to transform (compile, precompile) this code?
Can the functionality then be easily accessed from java code?
Thanks in advanced!Oracle already did. Pradeep is an Oracle developer working in Oracle9i Lite group. This is this Product Manager speaking
-
Embedded SQL query in C - variable not in select list
Hello everyone,
I am new to using embedded SQL in C. I have written a query based on some very similar code I have found and I keep getting this error:
ID: ORA-XXXX
OVRD:
TEXT: Oracle Errors Found - Consult Application Development Team
INFO:
SQLC: -1007
GLM: ORA-01007: variable not in select list
If anyone could help me figure out what I am doing wrong that is causing this error it would be much appreciated. Thanks in advance!
Here is the query that is generating the error, I have changed the variable names but the syntax is the same:
SELECT TEMP_TABLE.tble,
TEMP_TABLE.item_date,
TEMP_TABLE.item_number,
TEMP_TABLE.item_id,
TEMP_TABLE.amount,
TEMP_TABLE.method
FROM (
SELECT 'C' tble,
item_date,
item_number,
item_id,
amount,
method
FROM current
WHERE (settlement_date IS NULL)
UNION ALL
SELECT '1' tble,
item_date,
item_number,
item_id,
amount,
method
FROM prev1
WHERE (date IS NULL)
UNION ALL
SELECT '2' tble,
item_date,
item_number,
item_id,
amount,
pay_method
FROM prev2
WHERE (date IS NULL)
UNION ALL
SELECT '3' tble,
item_date,
item_number,
item_id,
amount,
pay_method
FROM prev3
WHERE (date IS NULL)
UNION ALL
SELECT '4' tble,
item_date,
item_number,
item_id,
amount,
method
FROM prev4
WHERE (date IS NULL)) TEMP_TABLE
WHERE (TEMP_TABLE.item_date,
TEMP_TABLE.item_number,
TEMP_TABLE.item_id) IN
(SELECT item_date, item_number, item_id
FROM item
WHERE (source, location) IN
(SELECT source, location
FROM SOURCE_REF
WHERE online = 'O'
AND (source, location) IN
(SELECT source,
location
FROM SOURCE_METHOD_REF
WHERE type = 'P')))Oh yeah I forgot to add that I have tested the query in TOAD and it works just fine so its something to do with embedding it into C I believe.
-
Can window and aggregate SQL functions be used in Pro*C embedded SQL?
It appears that window functions such as dense_rank() over(partition by ... order by ...) can not be used in Pro*C embedded SQL? Can somebody confirm that that is really the case?
Thanks
Rawender GuronPlease refer to this thread: "Is this forum also used for Pro*'C Questions? "
Is this forum also used for Pro*'C Questions? -
How to extract embedded SQL from crystal reports 8.5
I have a report created in version 8.5 with data source as crystal query (.qry) published on Crystal enterprise server.
I have lost Qry file but the report is running by executing the embedded SQL. Is there any option where I can extract the SQL statement that is embedded in the report file.Hi,
Go to 'Database' menu
select 'Database Expert....' submenu
It'll open 'Database Expert window. On right side of this window it shows 'Selected tables'. Under that it shows databsae name and the query used. Right click one it and you should see
Edit,
View, and
Add to Repository options.
Hope this will help. -
Compiling embedded SQL into a Win32 program using PRO*C/C++
Hello,
I have desperately been trying to precompile a Win32(C++) including embedded SQL with the pro*c editor. When I try to build my project I get linker errors telling me that sqliem was already declared in sqlcpr.h (which it wasn't). And I only seem to get these errors when I try to declare external variables or files in my program.
Any help would be greatly appreciated.
THANKS!!Hi,
I hadn't got errors.
Bit, i solved my problem using dynamic sql.
exemple:
void function(char name[50]){
EXEC SQL BEGIN DECLARE SECTION;
char *varsql;
EXEC SQL END DECLARE SECTION;
char toto[150]="CREATE TABLE test AS SELECT * FROM tutu WHERE employe='";
varsql=strcat(toto,name);
strcat(varsql,"'");
EXEC SQL EXECUTE IMMEDIATE :varsql;
I hope that could help somebody.
Bye and thank you for your answer.
Edited by: 899981 on 20 déc. 2011 05:28 -
Any tool to search Crystal Reports with embedded SQL
We have hundreds of Crystal Reports with embedded sql statements which have been developed over the years. Is there any tool which will allow us to scan all of the reports to see which ones might use a certain table, or is using a "group by" clause, or whatever ?
We'd prefer to not have to open each report to view the embedded sql.
Any thing that will extract the sql for us and dump it to a file ??
We have the reports as regular disk files, but they are also published to our Business Objects Enterprise XI R2 system (just an fyi in case there's an option on that side).Hi Wayne
There is a sample ras sdk code here that might be if use to you
Link: [https://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/402f2b94-da66-2b10-c598-de0d4b6058dc] -
Embedded SQL related precompiler
how to add the precompiler C/C++ tools in Oracle 10g std one edition server as well as client to implement embedded sql queries for creation,deletion , upation and selection of tables?
see these
http://download.oracle.com/docs/cd/B10500_01/appdev.920/a97269/toc.htm
http://www.oracle.com/pls/db10g/portal.portal_demo3?selected=5
http://programmingexamples.wikidot.com/deleted:pl-sql-precompiler-concepts -
I have some embedded SQL in a C program in UNIX (PRO*C). I've been trying to make what I thought was a simple enhancement, but I'm totally stumped at why I'm getting the results (or lack thereof) I'm getting. I added the below statement to the code in order to get an additional piece of data:
EXEC SQL
SELECT format_id_desc
INTO :gtd_struct[j].format_id_desc
FROM label_format
WHERE format_id = :gtd_struct[j].format_id;
I added some debug code to verify that the gtd_struct[j].format_id is indeed set to a valid value. And using that value, I can go into PL/SQL Developer and run the SQL statement against the same data, and the proper results display. But when I compile and link the C program, then run, I keep getting ORA-1403 (no data found) errors. I'm absolutely stumped as to why this is the case. Is there something else I can check, like possibly the C file that resulted from precompiling the .PC file, and if so, what could I check to see if anything strange is happening? Thank you for any help that you could give.What if you declare a VARCHAR type C variable (note that is Pro*C type VARCHAR not the SQL or PL/SQL type) of same size as gtd_struct[j].format_id
and initialize that with the value of gtd_struct[j].format_id and use that in your where clause instead?
EXEC SQL BEGIN DECLARE SECTION ;
VARCHAR l_format_id[5] ;
EXEC SQL END DECLARE SECTION ;
strcpy (l_format_id.arr, gtd_struct[j].format_id) ;
l_format_id.len = strlen(l_format_id.arr) ;
/* now use l_format_id in your where clause of the query and see what happens? */
. -
Embedded SQL-92 Functions in JDBC
It appears that the Oracle supplied JDBC drivers do not support embedded SQL-92 functions such as {fn UCASE(column)}. (I got this from the JDBC docs here online.) Does anyone know of a driver for Oracle that does support these features? I know it's not in Oracle's interests to help us be database neutral, but it's still a business requirement in the real world.
Thanks,
Dave
nullHello,
All oracle driver from i-net software support this feature.
http://www.inetsoftware.de/English/Produkte/JDBC_Overview/oracle.htm
Volker -
Gettin header files for embedded sql
Sir,
iam acutally looking for header files needed used in embedded sql,which is used pro c* compiler .So i request you to send me a link of these files,as iam tying to learn this topic.these files are not generally available in a genaral C compiler.
So please send me reply about this and also if this particular language/techn is still being used which may help me to improve my knowledgeI am not a Cobol programmer, but I worked several years a Pro*C programmer, this precompiler issue looks very similar to others I have several times faced, when I compiled a pro*C program on different platforms, the makefile had to be tailored to fit the particular platform paths. May be this is happening to you, you should verify the compilation script and ensure the required libraries are visible.
~ Madrid
Maybe you are looking for
-
Performance issue in Select Query on ERCH
Dear Friends, I have to execute a query on ERCH in production system having around 20 lakh data which keeps on increasing. "Select BELNR VERTRAG ADATSOLL from ERCH where BCREASON = u201803u2019 " . The expected volume of data that the query will retu
-
Developing on 1.4.2 but corporate s/w requires 1.3
I'm currently developing a system using Java version 1.4.2_04, but my company's travel expense accounting software requires 1.3.x. Is there a way that I can keep both versions on my system without causing problems on either end?
-
Can I call stored procedure with PL/SQL?
Oracle newbie question, it is. Assume a very simple stored procedure like this: Create or replace procedure aa ( inPar IN number, outPar OUT number) IS rrr Number; Begin Blah, blah, blah... rrr := inPar + 100; Blah, blah, blah... outPar := rrr; End;
-
Help with 11.0.3 ...URGENT!!
There is a request from our client to change all of the port numbers on a 11.0.3 Oracle Financials system. Port changes are for: 1 Oracle Database Listener 2 Oracle Reports Listener 3 Oracle Web Server ports 4 Oracle Forms Server ports In 11i, I know
-
HT5731 I am not able to download movie for rent
I can not down load rent movie