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.

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 Guron

    Please refer to this thread: "Is this forum also used for Pro*'C Questions? "
    Is this forum also used for Pro*'C Questions?

  • 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 Guron

    Please refer to this thread: "Is this forum also used for Pro*'C Questions? "
    Is this forum also used for Pro*'C Questions?

  • Converting ntext datatype of MS SQL to LOB datatype of Oracle using ODI

    Hi
    Could anyone help me how I can convert ntext datatype of MS SQL to BLOB/CLOB datatype of ORACLE using ODI tool? I have tried and it seems that ODI couldn't able to create working table with datatype of LOB.
    Thank you in advance.
    Myat

    Try using the Incremental Update (PL/SQL) IKM. I believe this will only handle 1 CLOB column in any interface - also pay attention to the KM notes for additional constraints and requirements.
    Make your staging area the same as the target.
    Use the TO_CLOB function to convert the data for your field, and execute this on the target.

  • XmlAgg Order By in SQL Statement vs Stored Procedure - 9.2.0.3.0

    Hi All,
    I'm having a problem with the XMLAgg function's ORDER BY clause after upgrading to 9.2.0.3.0.
    I'm finding that I can succesfully execute a SQL statement with the XMLAgg ORDER BY clause, but cannot compile a stored procedure using ORDER BY. Below are two examples executing against the SCOTT Schema. They use the same code, except one is contained in a procedure.
    I'm running 9.2.0.3.0 on Windows XP Pro, SP1
    Plain SQL Statement (executes correctly):
    SELECT
    XMLElement("test",
    XMLAgg(
    XMLElement("element",
    XMLAttributes(Scott.Emp.Ename as "ename", Scott.Emp.Empno as "enum")
    ) --xmlElement element
    ORDER BY Scott.Emp.Ename desc
    ) --XmlAgg
    ).getClobVal() --xmlElement test
    as TestXML
    from Scott.Emp;
    Stored Procedure:
    create or replace procedure zorder(TestXML OUT clob) is
    begin
    SELECT
    XMLElement("test",
    XMLAgg(
    XMLElement("element",
    XMLAttributes(Scott.Emp.Ename as "ename", Scott.Emp.Empno as "enum")
    ) --xmlElement element
    ORDER BY Scott.Emp.Ename desc
    ) --XmlAgg
    ).getClobVal() --xmlElement test
    into TestXML
    from Scott.Emp;
    end zorder;
    I get the following errors when attempting to compile the stored procedure:
    7 PLS-00306: wrong number of types or arguments in call to 'XMLAGG'
    7 PL/SQL: ORA-00904: "XMLAGG": invalid identifier
    5 PL/SQL: SQL Statement ignored
    Does anybody know why this code executes correctly in a SQL statement, but fails in a procedure? Is the Order By clause not available in a procedure? I need to get this functionality working in the procedure.
    Thanks,
    Brian

    A good simple workaround (that doesn't require runtime parsing) is to simply sub-query:
    SELECT
    XMLElement("test",
        XMLAgg(
            XMLElement(
                "element",
                XMLAttributes(Scott.Emp.Ename as "ename", Scott.Emp.Empno as "enum")
            ) --xmlElement element
        ) --XmlAgg
    ).getClobVal() --xmlElement test
    into TestXML
    from (
        SELECT Ename,Empno
        FROM Scott.Emp
        ORDER BY Scott.Emp.Ename desc

  • PASSING PARAMETER IN SQL STATEMENT .

    HI,
    Can any one tell me how to use on of the field name as a parameter in the same sql statement ? Here is what i am looking for :
    SELECT EMPNO, DEPTNO, (SELECT COUNT(ORDERNO) FROM ORDERS WHERE DEPTNO = :DEPTNO AND EMPNO = :EMPNO) TOTAL_ORDER FROM EMP;
    Here the embeded sql statment should take the paramter :DEPTNO , :EMPNO from the main sql statement. That means , each DEPTNO, EMPNO should be passed as a aparameter to the embeded SQL statement.
    Thanks
    Feroz

    WHATS THE CONACT, ||, +, HOW TO USE IT, CAN U GIVE ME AN EXAMPLE.
    SORRY , HERE IS THE ACTUAL THING WHAT I AM LOOKING FOR, I WANT TO GET THE MEDIAN AND MODE VALUE IN ORACLE, BUT COZ ORACLE DOES NOT HAVE IN BUILT FUNCTION TO ET THE ABOVE TOW , I WROTE MY SQL STATEMENTS, FOR EXAMPLE THE MEDIAN OF SAL FOR DEPT 20 IS IS
    SELECT AVG(SAL) FROM
    (SELECT RowNum The_Rownum, SAL FROM
    (SELECT SAL FROM EMP WHERE DEPTNO = 20 ORDER BY 1)) V
    WHERE V.The_Rownum = ( SELECT FLOOR((COUNT(SAL)+1)/2) FROM EMP WHERE DEPTNO = 20)
    OR V.the_rownum = (SELECT CEIL((count(SAL)/2) + 1/2) FROM EMP WHERE DEPTNO = 20)
    This median value ncalculation i can put in a functio and return it, but for a record os 1,800,000 volume, calling this function that many times, the sql never executes. It just hangs. so i thought if i can emabede the whole calculaton in the main sql statement instead of writing a function and calling that function in the sql statement. But the median calculation needs the department no as a parameter to calculate the median for that perticular department. Here , where the requirement of PARAMETER comes. ANY IDEA ???
    Thanks
    Feroz

  • Converting SQL statements from MS server 2000 to Oracle 10g

    We are moving over from MS server 2000 to Oracle 10g as our database for Peoplesoft system.
    There are several embedded SQL statements that I need to investigate to see what needs converting.
    So far I can see a need to convert the following:
    Dates.     GetDate() to ?
    Outer joins. *= to LEFT OUTER JOIN
    Has anyone else done a similar exercise and what other functions do I need to convert?
    Thanks.

    Hello
    A quick google search (http://www.google.co.uk/search?hl=en&q=ms+sql+server+oracle+differences&spell=1)
    came up with this:
    http://dba-oracle.com/oracle_news/2005_12_16_sql_syntax_differences.htm
    There's a quite a few more sites listed.
    HTH
    David

  • 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 select statements 8.04

    this is a tricky one to explain, I have sql statements that were written in oracle 8i and works, unfortunately it is now being run on oracle 8.04 and fails, we have tested out that field names are correct, and that all the functions like decode, avg, stddev etc all existed in version 7.0 (the oldest manual we have).
    The only message we are get using sql worksheet and having the sql statement in a text file, is missing expression after the third embedded sql statement (there is then another) so my first questions is does this older version of oracle have a limit on statement sizes, no of times sql select statements can be embedded. Any help would be greatly appreciated as though I know SQL i know little about Oracle.

    the code is roughly as follows(cut down a bit) , we cant use procedures, so have to send whole code through vb to oracle, using an account with read only access , where it says Select Sum (( sql worksheet reports an error of missing expression on this select:
    SELECT      0 AS Record_Type_Id,
         'INCLUDE' AS EXCLUDE_STATUS,
         Chrt.Chart_Number,
         Cpsl.scale,
         Othv.Chart_Version,
         Chrt.W_Dimension
    FROM
         Chart Chrt,
         Other_Version Othv,     
         ((     SELECT     chart_number, scale
              FROM      chart_panel
              WHERE     UPPER(panel_main_title) = 'MAIN PANEL'
              UNION
              SELECT chart_number,
              (SELECT SUM((     
                        SELECT Decode(STDDEV(CpnI.SCALE),0, AVG(CpnI.scale) / count(CpnI.scale),0)
                        FROM Chart_Panel CpnI
                   WHERE CpnI.Chart_Number = CpnO.Chart_Number
                        GROUP BY CpnI.Chart_Number))/count(cpno.chart_number) as AVGScale
                   FROM     Chart_panel CpnO
                   WHERE Cpno.chart_number = Cpn2.Chart_number
                   GROUP BY CpnO.chart_number) AS Scale
              FROM chart_panel Cpn2
              WHERE UPPER(panel_main_title) <> 'MAIN PANEL'
              AND Cpn2.chart_number NOT IN (SELECT Chart_number
                                  FROM Chart_panel
                                  WHERE UPPER(Panel_main_title) = 'MAIN PANEL'))
         UNION
              SELECT
              CHART_NUMBER AS Chart_Number, 0
              FROM
              CH[i]Long postings are being truncated to ~1 kB at this time.

  • 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

  • Preparing Dynamic SQL statement for inserting in Pro*C

    Hi Friends,
    From quite some time i am struggling writing Dynamic SQL statement for dynamic insert and update in Pro*C.
    Can somebody go through my code and suggest me the rigth way of doing.
    Right now it throws an error saying " Error while updating ORA-00904: invalid column name "
    Please help me.
    Girish.
    int main()
    EXEC SQL BEGIN DECLARE SECTION;
    char *uid ="scott/tiger";
    static char sqlstmt[129];
    struct /* DEPT record */
    int dept_num;
    char dept_name[15];
    char location[14];
    } dept_rec;
    EXEC SQL END DECLARE SECTION;
    EXEC SQL WHENEVER SQLERROR DO sql_error();
    EXEC SQL CONNECT :uid;
    dept_rec.dept_num = 50;
    strcpy(dept_rec.dept_name,"ADMIN");
    strcpy(dept_rec.location,"IN");
    strcpy(sqlstmt,"UPDATE dept set DNAME = dept_rec.dept_name where DEPTNO = dept_rec.dept_num");
    EXEC SQL EXECUTE IMMEDIATE:sqlstmt;
    EXEC SQL COMMIT;
    exit(0);
    void sql_error()
    printf("\nError while updating %s",sqlca.sqlerrm.sqlerrmc);
    EXEC SQL ROLLBACK;
    }

    A bit rusty here but this is how I see it.
    Think of it this way ..
    all Oracle is going to see is:
    UPDATE dept set DNAME = dept_rec.dept_name where DEPTNO = dept_rec.dept_num
    Its NOT going to know what dept_rec.dept_name is or dept_rec.dept_num is ..
    it doesnt go back and fill in those values.
    You need something like
    strcpy(sqlstmt,"UPDATE dept set DNAME = \"");
    strcat(sqlstmt,dept_rec.dept_name);
    strcat(sqlstmt,"\" where DEPTNO = ");
    strcat(sqlstmt,dept_rec.dept_num);
    printf(sqlsmt); # Just to be sure the update statement look right during testing.

  • 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

  • Embedded SQL blues

    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? */
    .

  • How to handle special characters in SQL statements

    How do you handle special charactes in a SQL statement? Here is an example:
    update table
    set notefield = 'This is Waldo's note'
    where keyfield = 7;
    Because the database connectivity vi accepts a string datatype wire, the ' in Waldo's note is seen as the end of string and an error is generated.
    Is there a way to tell labview that the ' is part of the string and not the string delimiter?
    Waldo

    If two single quotes don't work, try backslash single quote, like \'
    The backslash is often used as an escape character, meaning to treat the next character literally.
    - tbob
    Inventor of the WORM Global

  • Which is better - SQL Statement in APEX or as a function returning a type?

    Hi
    I have a general question about best practices for APEX development.
    If we have say a report region based on a SQL statement, is it better (from a performance perspective) to have the SQL statement defined in the region in APEX OR have the actual select statement executed in the backend and have the result set returned in a type to APEX?
    As an example:
    In APEX region
    SELECT col1, col2, col3 FROM table_aOR
    In APEX region
    select col1, col2, col3 from TABLE(CAST(<my package>.<my proceduere > AS <my type >)) ;<my package>.<my proceduere > would obviously execute the statement
    SELECT col1, col2, col3 FROM table_ausing dynamic SQL and return the results to APEX in thy type <my type>.
    Apologies if this sounds to be a really stupid thing to ask.
    Kind regards
    Paul

    Denes Kubicek wrote:
    You should use a pipelined function only then when you can't use SQL. Otherwise SQL is the way to go.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    ------------------------------------------------------------------------------thanks Denes... but does it matter if:
    1. The SQL statement is actually defined in the APEX region
    or
    2: The select statement is stored in a packageD function and returned to APEX?
    I seem to recall an article I read stating that it is best for all client applications to call stored procedures and functions rather than have SQL statement embedded in the actual application?
    Kind regards
    Paul

Maybe you are looking for

  • Airplay and Youtube

    got everything working now on Airplay with no internet,trouble is it wont play YouTube,keeps on saying your apple tv is not connected to the internet My question is  like Sky, you cant yet view YouTube over a non Internet connection

  • Need Bluetooth Drivers For G430 38Q

    My inbuilt bluetooth is not working coz no drivers. I cant install drivers from the cd coz it has vista drivers and i have xp. Plz .. Someone provide me with XP drivers

  • Introscope Agent Settings

    Hi folks, Quick question this one probably. Can anyone tell me where this screenshot was taken from in Solution Manager please?  I've looked and looked and just cannot find it. Hopefully someone may recognise it?? Thanks

  • Cropping a pic is creating a 64gig temp file!

    Not sure what's going on here, but when I crop a picture I'm immediately filling all the available space on my hard drive which happens to be 64gigs! Once I get the scratch disk error due to filling up the hd and click Ok the temp file automatically

  • CKME Manual Price Release Error (C+811)

    My Dear Experts.... The process of client is..... Do cost estimate for the next period (i.e. costing date from as 1st of every next period) and marking using CK40N on every month 28th On last day of the month, after business hours, they lock all user