NoSQL + SQL LOBs

Hello, everyone!
I have one question about Oracle NoSQL. It can store huge ammount of data and operate it using oracle.kv.lob package.
It can also translate data to a common relational Oracle Database 11gR2 using External Tables mechanism.
But combining these two mechanisms getting me a big trouble.
In ideal way I want to write:
SELECT PK, oracle_BLOB
FROM NoSQL_ExternalTable
WHERE PK in (<list of integer>);
BUT (now difficult part begins)
1)As documentation says, method toOracleLoaderFormat of Formatter interface returns String only. So you can not return unstructured data or especially 1GB of unstructured data in an ordinal way. The workaround is to use temporary files: unload NoSQL BLOB to a stream, write the stream to a temp file and then read this file using oracle BFILE locator. Yes, I encapsulated filewritting mechanism in toOracleLoaderFormat. But this method is slow, on kvlite database it takes 1:41 minutes to select 1,8 GB file and temp file is a really bottleneck.
2) As far as I encapsulated filewritting mechanism in toOracleLoaderFormat function, every time preprocessor invokes this method, a new 1 GB file is created.
And as long as NoSQL does full scan on its database using ETables, every SELECT results in ALL files extracted in temp directory.
As a crutch I used another file with list of PK that I needed. It is taken to be that this file will have been formed BEFORE main SELECT procedes.
So initially formatter function reads this file and then compares Key part of incoming KeyValueVersion variable with contents of this file. If the Key is in list then extracting proceeds.
For example, PK file contains 1000, 1001, 1003 and NoSQL DB contains recors with keys like
exttab/1000/-/document/archive1000.zip
exttab/9000/-/document/archive9000.zip
Preprocessor invokes Formatter with parameter kvv (key part) = exttab/1000/-/document/archive1000.zip, Formatter parses key, extracts 1000.
Then it reads PK file, finds record 1000 and puts huge 2GB archive to temp dir. When it doesn't find record 9000 it doesn't put a huge archive to temp dir.
==================================================================================
Is there any idea how to perform seamlesly SELECT of BLOB (BFILE) from NoSQL to "SQL" database in a less complicated way and in acceptable time?
==================================================================================
Edited by: 1004734 on May 8, 2013 3:26 PM

Charles, sorry, I tried to send the file from my personal mail (mail.ru domain), but your mail is unroutable.
By the way I tried to create eTable:
CREATE TABLE nosql_data_blob_test (PK integer,
docfilename varchar2(120),
docdata blob)
organization external
(type oracle_loader
default directory ext_tab
access parameters
(records delimited by newline
preprocessor nosql_bin_dir:'nosql_stream'
fields terminated by '|'
PK CHAR(30),
docfilename char(60)
COLUMN TRANSFORMS (docdata FROM LOBFILE (docfilename) FROM (temp_dir) BLOB)
location (ext_tab:'nosql_blob.dat'))
PARALLEL;
After setting all parameters (publishing, etc..) I tried SELECT and got error which in short sounds like Oracle can not see temp_dir but tries to look up ext_tab directory.
But even when I manually copy the file from temp_dir to ext_tab I got another very strange error:
ora-12801 error signaled in parallel query server P000
ora-29913 error in executing odciexttablefetch callout
ora-29400 data cartridge error
KUP-04095 preprocessor command
/home/oracle/kvhome/exttab/bin/nosql_stream encountered error
"java.lang.IllegalStateException: Error of parsing line 1 of
/home/oracle/kvhome/data/TEXT: content is not allowed in prolog.
/home/oracle/kvhome/data/ is ext_tab directory
/home/oracle/kvhome/exttab/bin/ is nosql_bin_dir directory
TEXT is the file I tried to get as blob
What am I doing wrong? May be preprocessor tries to parse TEXT file?
I go holydays up to 12 may, see you that day.
Edited by: Arsenikum on 09.05.2013 2:43

Similar Messages

  • Need help with adding an SQL LOB target for BizTalk Services

    The goal is to create a SQL LOB to connect to an Azure SQL database. However, the connection parameters are not getting accepted, and the error, "A network-related
    or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes
    Provider, error: 40 - Could not open a connection to SQL Server)", is encountered.
    Both the SQL Azure and the database firewall rules have been set to allow the local system IP... No go...
    Could you please suggest what to provide in the connection parameters.
    Thanks and warm regards,
    Chandrasekhar G

    Thank you for your response, Fanny.
    Yes, I've been doing that already...
    Server names tried:xxxxxxxx.database.windows.net and
    xxxxxxxx.database.windows.net,1433
    Catalog: database_name
    Similarly with the username; tried user, user@servername
    and user@full-qualified-server-name.
    Also tried turning on the firewall rules at the db level...
    Enabled port 1433, too, from my local computer on the outbound, as a Microsoft link suggested.
    Even tried setting the Encrypt property to True.
    I tried telneting on port 1433 from an Azure VM and it works. But not from my local system, though there are no restrictions on this corporate network. Just ports 80 and 1433...
    I think that the Azure SQL database does not allow port 1433 for IPs, outside of the Azure network. Trying to figure out how to enable that to allow my IP on this specific 1433 port...
    Thanks and warm regards,
    Chandrasekhar G

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

  • How to UpLoad the Diffent type of files Through Oracle Pl/Sql...?

    Hi TOM,
    I want one reusable component to be developed, My requirement is as follows...
    We get .CSV,.XML,.DOC.PDF files on the N/w drive. One Batch Job will be running every night and this job should upload all the files present in that N/w drive to the database (Each File should be stored in one row with unique ID) and after loading of each file is done , move the uploaded file to the backup directory.
    Note : Average file size is 10-15 MB.
    Loading of files in database should be done only using Oracle procedure/function.
    Already return this process in Pro*C. But I don't know How to write in Oravle Pl/Sl...?
    Functionality of this FUNCTION(In Pro*C):
    ===================================
    *****set_item_blob
    *****Input:     
    *****======
    *****1. Path of the file in Windows folder which contains the part number's content
    *****2. Item number in the T_ITEM table
    *****3. Revision level in the T_ITEM table
    *****Processing:
    *****===========
    *****1. Get the BLOB pointer for the ITM_BLOB column,
    ***** for the corresponding item number and revision level
    *****2. Update the ITM_BLOB column with the content of the input file
    ***** ( using the EXEC SQL LOB WRITE function )
    *****Output:
    *****=======
    *****1. ITM_BLOB column updated with the content of input file
    int set_item_blob (char chr_item_number,int revision_level,char file_path)
         exec sql begin declare section;
              OCIBlobLocator     *blob_locator;
              varchar               vc_item_number[12];
              long               file_length=0;
              varchar               alert_message [500+1];
              int                    plsql_err_code = 0;
         exec sql end declare section;
         FILE     *fp_input_file;
         char     *blob_buffer;
         EXEC SQL VAR blob_buffer IS RAW(BUFFER_LENGTH);
         EXEC SQL ALLOCATE :blob_locator;
         memset ( vc_item_number.arr, '\0', 12 );
         strcpy ( vc_item_number.arr, chr_item_number );
         vc_item_number.len = strlen ( vc_item_number.arr );
         fp_input_file = fopen( file_path, "rb" );
         if( fp_input_file == NULL)
              sprintf ( alert_message.arr, "ngetupld BLOB upload failed for item_number = [%s], rev_level = [%d]. Failure in opening the file to be uploaded [%s]", chr_item_number, revision_level , file_path );
              alert_message.len = strlen ( alert_message.arr );
              EXEC SQL EXECUTE
              BEGIN
                   P_INSERT_INTO_INFO_MESSAGES('AL',:alert_message,'BLB',NULL,NULL,:plsql_err_code);
              END;
              END-EXEC;
              exec sql commit;
              return 1;
         else
              (void) fseek(fp_input_file, 0L, SEEK_END) ;
              file_length = (unsigned int)ftell(fp_input_file) ;     
              (void) fseek(fp_input_file, 0L, SEEK_SET) ;
              if ( file_length > BUFFER_LENGTH )
                   sprintf ( alert_message.arr, "ngetupld BLOB upload failed for item_number = [%s], rev_level = [%d]. Length of the file to be uploaded(%ld) is more than the supported length(%ld)", chr_item_number, revision_level , file_length, BUFFER_LENGTH );
                   alert_message.len = strlen ( alert_message.arr );
                   EXEC SQL EXECUTE
                   BEGIN
                        P_INSERT_INTO_INFO_MESSAGES('AL',:alert_message,'BLB',NULL,NULL,:plsql_err_code);
                   END;
                   END-EXEC;
                   exec sql commit;
                   return 1;
              EXEC SQL
                   UPDATE          T_ITEM
                   SET               ITM_BLOB = EMPTY_BLOB()
                   WHERE          ITM_NUMBER = :vc_item_number
                   AND               ITM_REVISION_LEVEL = :revision_level
                   RETURNING     ITM_BLOB INTO :blob_locator;
              if ( sqlca.sqlcode != 0 )
                   sprintf ( alert_message.arr, "ngetupld BLOB upload failed for item_number = [%s], rev_level = [%d]. SQL error %d occured while trying to get the BLOB locator", chr_item_number, revision_level , sqlca.sqlcode );
                   alert_message.len = strlen ( alert_message.arr );
                   EXEC SQL EXECUTE
                   BEGIN
                        P_INSERT_INTO_INFO_MESSAGES('AL',:alert_message,'BLB',NULL,NULL,:plsql_err_code);
                   END;
                   END-EXEC;
                   exec sql commit;
                   return 1;
              blob_buffer=(char *)malloc(BUFFER_LENGTH); // Dynamic Memory Allocation for Itm_Blob
              fread((void *)blob_buffer, (size_t)BUFFER_LENGTH, (size_t)1, fp_input_file);
              EXEC SQL LOB WRITE ONE :file_length FROM :blob_buffer INTO :blob_locator;
              if ( sqlca.sqlcode != 0 )
                   sprintf ( alert_message.arr, "ngetupld BLOB upload failed for item_number = [%s], rev_level = [%d]. SQL error %d occured while trying to update the BLOB content", chr_item_number, revision_level , sqlca.sqlcode );
                   alert_message.len = strlen ( alert_message.arr );
                   EXEC SQL EXECUTE
                   BEGIN
                        P_INSERT_INTO_INFO_MESSAGES('AL',:alert_message,'BLB',NULL,NULL,:plsql_err_code);
                   END;
                   END-EXEC;
                   exec sql commit;
                   return 1;
              exec sql commit;
         fclose(fp_input_file);
         free(blob_buffer);
         return 0;
    Can Possible to do in Oacle Pl/Sql...?

    > Hi TOM,
    This is not asktom.oracle.com.
    > Can Possible to do in Oacle Pl/Sql...?
    Yes it can be done. Simply consult the applicable manuals that contains all of the details on how to do it. The manuals are:
    - Oracle® Database Application Developer's Guide - Large Objects (refer to Chapter 6 section on Using PL/SQL (DBMS_LOB Package) to Work with LOBs)
    - Oracle® Database PL/SQL Packages and Types Reference (refer to the chapter on DBMS_LOB)

  • Selecting xml-messages from ORABPEL-schema via SQL

    Hi,
    i want to select xml documents via SQL from the ORABPEL schema.
    Can anybody help, how to do this?
    There is the table xml_document, which has the columns:
    DOCKEY
    DOMAIN_REF
    BIN_CSIZE
    BIN_USIZE
    BIN
    MODIFY_DATE
    BIN_FORMAT
    Bin is of type blob....

    "Installation Monkey", did you ever find a solution or sample code to access and decipher the Audit_trail.LOG contents through a query or using SQL lob calls?
    I have looked all over, tried decoding the hex code (into a second layer of gibberish), and found nothing other than pointers to the API bpels.
    Thank you for any information.

  • ORA-00060 on LOB TRIM

    Has anyone run into this before? Our application uses SQL embedded into C programs. The code that deals with writing to the BLOB looks like this:
    EXEC SQL WHENEVER SQLERROR GOTO write_fail;
    EXEC SQL LOB WRITE ONE :amt
    FROM :lvr WITH LENGTH :nbytes INTO :blob AT :offset;
    EXEC SQL LOB TRIM :blob TO :nbytes;
    EXEC SQL WHENEVER SQLERROR continue;
    We added the LOB TRIM so that if the LOB was now smaller than it was the last time it was written, the space would be freed up. However, SOMETIMES (note not always), the LOB TRIM gets sqlcode -60. I could change the application code to issue a commit and re-locate the blob and trim it, but it doesn't seem like I should have to. We're running Oracle 9i 9.2.0.
    Thanks.

    Also, look for a trace file in the folder specified by your initialization parameter 'user_dump_dest'. Use TKPROF to format it. In that you should be able to see the session IDs involved, the SQL statement issued in each transactions and the rows on which the locks were held in each session involved in the dead lock.

  • Writing BLOB column from Cobol

    Hi,
    I´m using the Pro*Cobol pre-compile to execute SQL statements into programs Cobol Net Express.
    I need two helps.
    1 - How can do to the Pro*Cobol cut the blanks on the right into PIC X Varying hosts variables ?
    For example :
    ..... LastName VARCHAR(20)
    ..... 05 LASTNAME PIC X(20) VARYING.
    The Pro*Cobol documentation say that precompile transform the elementary item LASTNAME to the group item bellow :
    05 LASTNAME.
    10 LASTNAME-LEN PIC S9(04) COMP.
    10 LASTNAME-ARR PIC X(20).
    When a string less than 20 is moved to LASTNAME-ARR, the exact string lenght is moved to the LASTNAME-LEN and the string is writen
    into DB without blanks on right.
    When a string is red from DB, the precompile write into LASTNAME-LEN the exact string lenght and the LASTNAME-ARR receive the
    string value without blanks on write.
    Occurs that when I compile the program the Pro*Cobol/Micro Focus don´t recognize LASTNAME-LEN and LASTNAME-ARR.
    Am I correct ? May I use any directive that resolve that ?
    2 - I need to check these step-by-step to write a text file generated from cobol into a BLOB column.
    The LOAD FROM FILE statement receive SQLCODE -22275 : Invalid LOB locator specified.
    Assumptions :
    MAG-RELAT-BFILE SQL-BFILE.
    MAG-RELAT-BLOB SQL-BLOB.
    The fiel R1401 exists in D:\Petros\NE\
    Source Code :
    MOVE 'D:\Petros\NE\' TO ALIAS
    MOVE 13 TO ALIAS-L
    MOVE 5 TO FILENAME-L
    MOVE 'R1401' TO FILENAME
    EXEC SQL
    ALLOCATE :IMAG-RELAT-BFILE
    END-EXEC.
    IF SQLCODE NOT EQUAL +0
    MOVE 'ERRO COMANDO ALLOCATE' TO WW-CA-MENSAGEM
    MOVE 'IMAG-RELAT-BFILE' TO WW-CA-ARQUIVO
    MOVE SQLCODE TO WW-ST-ARQUIVO
    MOVE 08 TO RETURNO-CODE
    PERFORM 999-TRATA-ERRO THRU 999-FIM
    END-IF.
    EXEC SQL
    LOB FILE SET :IMAG-RELAT-BFILE
    DIRECTORY = :ALIAS,
    FILENAME = :FILENAME
    END-EXEC.
    IF SQLCODE NOT EQUAL +0
    MOVE 'ERRO COMANDO LOB FILE SET' TO WW-CA-MENSAGEM
    MOVE 'IMAG-RELAT-BFILE' TO WW-CA-ARQUIVO
    MOVE SQLCODE TO WW-ST-ARQUIVO
    MOVE 08 TO RETURNO-CODE
    PERFORM 999-TRATA-ERRO THRU 999-FIM
    END-IF.
    EXEC SQL
    ALLOCATE :IMAG-RELAT-BLOB
    END-EXEC
    IF SQLCODE NOT EQUAL +0
    MOVE 'ERRO COMANDO ALLOCATE' TO WW-CA-MENSAGEM
    MOVE 'IMAG-RELAT-BLOB' TO WW-CA-ARQUIVO
    MOVE SQLCODE TO WW-ST-ARQUIVO
    MOVE 08 TO RETURNO-CODE
    PERFORM 999-TRATA-ERRO THRU 999-FIM
    END-IF.
    EXEC SQL
    LOB LOAD :TOTAL-BYTES
    FROM FILE :IMAG-RELAT-BFILE
    INTO :IMAG-RELAT-BLOB
    END-EXEC.
    IF SQLCODE NOT EQUAL +0
    MOVE 'ERRO COMANDO LOAD FFOM FILE' TO WW-CA-MENSAGEM
    MOVE 'IMAG-RELAT-BFILE, IMAG-RELAT-BLOB' TO WW-CA-ARQUIVO
    MOVE SQLCODE TO WW-ST-ARQUIVO
    MOVE 08 TO RETURNO-CODE
    PERFORM 999-TRATA-ERRO THRU 999-FIM
    END-IF.
    Thanks,

    907466 wrote:
    Hi,
    I´m using the Pro*Cobol pre-compile to execute SQL statements into programs Cobol Net Express.
    I started my career as a cobol programmer in 1981, and the last project I worked on before transitioning to DBA was implementing MF Cobol. It's been a number of years but ...
    I need two helps.
    1 - How can do to the Pro*Cobol cut the blanks on the right into PIC X Varying hosts variables ?
    For example :
    ..... LastName VARCHAR(20)
    ..... 05 LASTNAME PIC X(20) VARYING.
    The Pro*Cobol documentation say that precompile transform the elementary item LASTNAME to the group item bellow :
    05 LASTNAME.
    10 LASTNAME-LEN PIC S9(04) COMP.
    10 LASTNAME-ARR PIC X(20).
    When a string less than 20 is moved to LASTNAME-ARR, the exact string lenght is moved to the LASTNAME-LEN and the string is writen
    into DB without blanks on right.
    When a string is red from DB, the precompile write into LASTNAME-LEN the exact string lenght and the LASTNAME-ARR receive the
    string value without blanks on write.
    Occurs that when I compile the program the Pro*Cobol/Micro Focus don´t recognize LASTNAME-LEN and LASTNAME-ARR.
    Am I correct ? May I use any directive that resolve that ?
    I don't know if you are correct or not. Is the pre-compiler or compiler step throwing an error message? If you are correct, there should be an error message that you should share with us.
    2 - I need to check these step-by-step to write a text file generated from cobol into a BLOB column.
    The LOAD FROM FILE statement receive SQLCODE -22275 : Invalid LOB locator specified.
    Assumptions :
    MAG-RELAT-BFILE SQL-BFILE.
    MAG-RELAT-BLOB SQL-BLOB.
    The fiel R1401 exists in D:\Petros\NE\
    Source Code :
    MOVE 'D:\Petros\NE\' TO ALIAS
    MOVE 13 TO ALIAS-L
    MOVE 5 TO FILENAME-L
    MOVE 'R1401' TO FILENAME
    EXEC SQL
    ALLOCATE :IMAG-RELAT-BFILE
    END-EXEC.
    IF SQLCODE NOT EQUAL +0
    MOVE 'ERRO COMANDO ALLOCATE' TO WW-CA-MENSAGEM
    MOVE 'IMAG-RELAT-BFILE' TO WW-CA-ARQUIVO
    MOVE SQLCODE TO WW-ST-ARQUIVO
    MOVE 08 TO RETURNO-CODE
    PERFORM 999-TRATA-ERRO THRU 999-FIM
    END-IF.
    EXEC SQL
    LOB FILE SET :IMAG-RELAT-BFILE
    DIRECTORY = :ALIAS,
    FILENAME = :FILENAME
    END-EXEC.
    IF SQLCODE NOT EQUAL +0
    MOVE 'ERRO COMANDO LOB FILE SET' TO WW-CA-MENSAGEM
    MOVE 'IMAG-RELAT-BFILE' TO WW-CA-ARQUIVO
    MOVE SQLCODE TO WW-ST-ARQUIVO
    MOVE 08 TO RETURNO-CODE
    PERFORM 999-TRATA-ERRO THRU 999-FIM
    END-IF.
    EXEC SQL
    ALLOCATE :IMAG-RELAT-BLOB
    END-EXEC
    IF SQLCODE NOT EQUAL +0
    MOVE 'ERRO COMANDO ALLOCATE' TO WW-CA-MENSAGEM
    MOVE 'IMAG-RELAT-BLOB' TO WW-CA-ARQUIVO
    MOVE SQLCODE TO WW-ST-ARQUIVO
    MOVE 08 TO RETURNO-CODE
    PERFORM 999-TRATA-ERRO THRU 999-FIM
    END-IF.
    EXEC SQL
    LOB LOAD :TOTAL-BYTES
    FROM FILE :IMAG-RELAT-BFILE
    INTO :IMAG-RELAT-BLOB
    END-EXEC.
    IF SQLCODE NOT EQUAL +0
    MOVE 'ERRO COMANDO LOAD FFOM FILE' TO WW-CA-MENSAGEM
    MOVE 'IMAG-RELAT-BFILE, IMAG-RELAT-BLOB' TO WW-CA-ARQUIVO
    MOVE SQLCODE TO WW-ST-ARQUIVO
    MOVE 08 TO RETURNO-CODE
    PERFORM 999-TRATA-ERRO THRU 999-FIM
    END-IF.
    Thanks,So far you haven't shown us any symptoms, errors, etc. Just a description of what you are doing and a statement that you assume it won't work. Your executable code has a lot of reference to host variables that we can only assume a spelled correctly to match to variables you've declared in your data division. Are you going straight from submitting precompile to run-time, or are you using the very excellent interactive source-level debugger that is a prime feature of MF Cobol?

  • Pro*c selecting XMLElement strangeness

    I've had a pro*c problem that I can't figure out. Hopefully, one of you might be able to do so. I am trying to create a XML output from a select statement. I having several problems, but the first one is that I can't get a simple XMLElement to work.
    Depending on how I do it, it either does not pre-compile or compiles - but does not work. Both queries work correctly in SQL*Plus.
    Pro*c Code >>>>>>>>>>>>
    EXEC SQL BEGIN DECLARE SECTION ;
    OCIClobLocator *xmltype_lob;
    EXEC SQL END DECLARE SECTION ;
    EXEC SQL ALLOCATE :xmltype_lob;
    EXEC SQL LOB CREATE TEMPORARY :xmltype_lob;
    EXEC SQL
    SELECT XMLElement("eligVerification", dummy ).getClobVal() <--line 125
    INTO :xmltype_lob
    FROM dual;
    if ( sqlca.sqlcode != 0 )
    fprintf (stderr, "Failed to get XML sqlca.sqlcode = %d\n" , sqlca.sqlcode ) ;
    fflush(stderr);
    exit ( EXIT_FAILURE ) ;
    <<<<<<<<<<<<
    This fails on the pre-compile:
    Syntax error at line 125, column 55, file tester.sc:
    Error at line 125, column 55 in file tester.sc
    XMLElement("eligVerification", dummy ).getClobVal()
    ......................................................1
    PCC-S-02201, Encountered the symbol "." when expecting one of the following:
    , * + - / | an identifier, a quoted string, at, date, into,
    as, count, from, day, extract, hour, interval, minute, month,
    second, time, timestamp, treat, trim, year, avg, max, min,
    sum, stddev, variance,
    ======================
    If I remove the .getClobVal(), the SELECT now looks like:
    Changed >>>>>>
    EXEC SQL
    SELECT XMLElement("eligVerification", dummy )
    INTO :xmltype_lob
    FROM dual;
    <<<<<<<<<<<<
    This does get thru the pre-compile and compiles just fine. At run time, I get this:
    Failed to get XML sqlca.sqlcode = -932
    From oerr, that is: 00932, 00000, "inconsistent datatypes: expected %s got %s"
    Any thoughts?
    We are using:
    SunOS 5.10 Generic_147440-27 sun4u sparc SUNW,SPARC-Enterprise
    Sun C 5.12 SunOS_sparc 2011/11/16
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE 11.2.0.3.0 Production
    TNS for Solaris: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    Pro*C/C++: Release 11.2.0.3.0
    Edited by: 989848 on Feb 22, 2013 12:43 PM

    SELECT XMLElement("eligVerification", dummy ).getClobVal()
    The syntax of this function call is wrong. XMLElement takes two parameters ("<NAME>", Identifier). You have added a call to GetClobVal(). You cannot do this!
    See how to use XMLElement here... http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions220.htm
    The second problem is a type mismatch in the data you are bringing back and the variable you are trying to store it in. Remember C and Oracle datatypes are not the same!
    Edited by: 996008 on 25-Mar-2013 08:15

  • Size limit for files uploaded to htmldb_application_files

    Hi,
    Is there any size limit for files which are to be uploaded to htmldb_application_files (and then stored as BLOB in db)?
    Regards,
    Tom

    Hi Tom,
    the only limitation is that the BLOB data type is 4GB
    large.
    So you can store max. 4 GB data in BLOB.Did you mean BFILE? Depending on the version, size limit is between 8TB and 128TB, as in the 10g2 documentation:
    PL/SQL LOB Types
    C.

  • Access Reports, Forms in Oracle Database

    Hi,
    I want to migrate one application from MS-Access to Oracle(8.1.5) Database.
    I know, migration of database is possible,but I want to keep the existing Access reports and forms as it is.
    Is it possible, Can Access reports and forms run under oracle database.

    Initially you write 12345 and when you modify you are modiyfing only 3 bytes from offset 1 and hence the results. When you modify oracle will not erase the complete lob you need to use erase before you modify (write)
    Following doc give you an insight into pl/sql lob functions
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_lob.htm#sthref4428
    Following is the Pro*C Lobs Guide
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28427/pc_16lob.htm#i998068

  • Access BLOB field in Oracle database

    Dear Sir,
    I am using Pro* C to access oracle blob fields
    I write "12345" to Oracle Blob field, when I read it it is fine.
    I then modify this record to "ABC", when I read it, I get "ABC45",
    How can I set blob field to the initial state to modify BLOB field correctly ?
    Many Thanks
    Liang

    Initially you write 12345 and when you modify you are modiyfing only 3 bytes from offset 1 and hence the results. When you modify oracle will not erase the complete lob you need to use erase before you modify (write)
    Following doc give you an insight into pl/sql lob functions
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_lob.htm#sthref4428
    Following is the Pro*C Lobs Guide
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28427/pc_16lob.htm#i998068

  • Slow in updating blob

    I have a table with a blob column. The table is partitioned. Each partition has about 600,000 rows of data. The blob size is between 6000 bytes to 13000 bytes.
    The lob is defined as CHUNK 8192 and PCTVERSION 15
    Normally only very small percentage of the blob column will be updated and there is no performance issue.
    However, recently, I have a need to update about 90 % of the blob. It appeared that the performance was good at the beginning and it kept going down. For example, it updated 9 rows per second for the first 7000 records., 8 rows per second for the next 8000 records, 7 rows per second for the next 5000 records…… after 140,000 record, it only update 2.5 rows per second and it kept going down.
    Does the PCTVERSION 15 cause any problem on this? Does anybody know how I can improve the perfomance on updating the blob?

    Oracle version is 10.2.0.3.0
    The update statements are as follows:
    int offset=1;
    EXEC SQL ALLOCATE :lob;
         EXEC SQL UPDATE stories SET body = EMPTY_BLOB()
                   WHERE storyid = :storyid RETURNING body INTO :lob;
         EXEC SQL LOB WRITE ONE :lobsz FROM :lvr WITH LENGTH :lobsz
                                  INTO :lob AT :offset;
    *** FYI - the length of the blob has the same size before and after, only the content changes..

  • XML select issue strangeness - pro*c

    I've had a pro*c problem that I can't figure out. Hopefully, one of you might be able to do so. I am trying to create a XML output from a select statement. I having several problems, but the first one is that I can't get a simple XMLElement to work.
    Depending on how I do it, it either does not pre-compile or compiles - but does not work. Both queries work correctly in SQL*Plus.
    Pro*c Code >>>>>>>>>>>>
    EXEC SQL BEGIN DECLARE SECTION ;
    OCIClobLocator *xmltype_lob;
    EXEC SQL END DECLARE SECTION ;
    EXEC SQL ALLOCATE :xmltype_lob;
    EXEC SQL LOB CREATE TEMPORARY :xmltype_lob;
    EXEC SQL
    SELECT XMLElement("eligVerification", dummy ).getClobVal() <--line 125
    INTO :xmltype_lob
    FROM dual;
    if ( sqlca.sqlcode != 0 )
    fprintf (stderr, "Failed to get XML sqlca.sqlcode = %d\n" , sqlca.sqlcode ) ;
    fflush(stderr);
    exit ( EXIT_FAILURE ) ;
    <<<<<<<<<<<<
    This fails on the pre-compile:
    Syntax error at line 125, column 55, file tester.sc:
    Error at line 125, column 55 in file tester.sc
    XMLElement("eligVerification", dummy ).getClobVal()
    ......................................................1
    PCC-S-02201, Encountered the symbol "." when expecting one of the following:
    , * + - / | an identifier, a quoted string, at, date, into,
    as, count, from, day, extract, hour, interval, minute, month,
    second, time, timestamp, treat, trim, year, avg, max, min,
    sum, stddev, variance,
    ======================
    If I remove the .getClobVal(), the SELECT now looks like:
    Changed >>>>>>
    EXEC SQL
    SELECT XMLElement("eligVerification", dummy )
    INTO :xmltype_lob
    FROM dual;
    <<<<<<<<<<<<
    This does get thru the pre-compile and compiles just fine. At run time, I get this:
    Failed to get XML sqlca.sqlcode = -932
    From oerr, that is: 00932, 00000, "inconsistent datatypes: expected %s got %s"
    Any thoughts?
    We are using:
    SunOS 5.10 Generic_147440-27 sun4u sparc SUNW,SPARC-Enterprise
    Sun C 5.12 SunOS_sparc 2011/11/16
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE 11.2.0.3.0 Production
    TNS for Solaris: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    Pro*C/C++: Release 11.2.0.3.0

    You need the precompiler option: common_parser=yes
    (it was added in version 11)
    I don't know how to work with OCIClobLocator, but I was able to select some XML into a string:
    EXEC SQL BEGIN DECLARE SECTION ;
    OCIClobLocator *xmltype_lob;
    char s[500+1];
    EXEC SQL VAR s is STRING;
    EXEC SQL END DECLARE SECTION ;
    EXEC SQL ALLOCATE :xmltype_lob;
    EXEC SQL LOB CREATE TEMPORARY :xmltype_lob;
    EXEC SQL
    SELECT
         NULL
         XMLElement("eligVerification", dummy ).getClobVal()
    INTO
         :s
         :xmltype_lob
    FROM dual;Edited by: 940607 on Feb 25, 2013 10:57 AM

  • Intermittent  SYS.DBMS_LOB error

    Approximately 20% of the time my BLOB inserts fail on my Oracle
    8.1.7 instance that's running on Solaris. I'm doing all my db
    calls via JDBC.
    The same code works flawlessly against an 8.1.7 instance running
    on Linux. The only difference between the two instances, other
    than the OS, is that the BLOBS are stored in an NFS-mounted
    volume for the Solaris instance (the one with the problems).
    The error I'm getting is as follows:
    java.io.IOException: ORA-27052: unable to flush file data
    SVR4 Error: 11: Resource temporarily unavailable
    Additional information: 3
    ORA-06512: at "SYS.DBMS_LOB", line 700
    ORA-06512: at line 1
    at oracle.jdbc.dbaccess.DBError.SQLToIOException
    (DBError.java:531)
    at oracle.jdbc.driver.OracleBlobOutputStream.flushBuffer
    (OracleBlobOutputStream.java:179)
    at oracle.jdbc.driver.OracleBlobOutputStream.write
    (OracleBlobOutputStream.java:125)
    This same thing seems to happen no matter what version of
    Oracle's JDBC driver I use. I've tried the jdk 1.2 drivers for
    Oracle 8.1.7, 8.1.7.1 and even 9.0.1.
    I'm guessing that the DB is trying to flush the buffer out to
    the filesystem and the NFS call is taking too long, or possibly
    something else along these lines.
    Any ideas on how to solve this one? Pointers would be
    appreciated because the documentation doesn't have a lot to say
    on this, and I haven't been able to find anything similar in the
    discussion forums.
    Thanks in advance!

    You may helpful this link.
    https://kr.forums.oracle.com/forums/thread.jspa?threadID=354057
    External LOBs
    For an external LOB (BFILE) to be represented by a LOB locator, you must:
    Ensure that a DIRECTORY object representing a valid, existing physical directory has been defined, and that physical files (the LOBs you plan to add) exist with read permission for the database. If your operating system uses case-sensitive path names, then be sure you specify the directory in the correct format.
    Pass the DIRECTORY object and the filename of the external LOB you are adding to the BFILENAME function to create a LOB locator for your external LOB.
    Once you have completed these tasks, you can insert or update a row containing a LOB column using the given LOB locator.
    After the LOBs are defined and created, you can then SELECT from a LOB locator into a local PL/SQL LOB variable and use this variable as an input parameter to DBMS_LOB for access to the LOB value.
    For details on the different ways to do this, you must refer to the section of the Oracle Database Application Developer's Guide - Large Objects that describes "Accessing External LOBs (BFILEs)."

  • ORA-24810 on writing blob via Pro*C

    I'm using Oracle Pro*C with an Oracle 9.2 RDBMS.
    I am trying to store a blob from a file using Pro*C. If the file is small enough that I can read/write the entire file in a single operation, it blow write works okay. However, I would like to be able to handle a blob of any size, up to 4MB. Unless, I use a 4MB io buffer, this requires partial file read / blob writes. In the program before, the initial write (first) works, but subsequent writes (next) fail with the 24810 attempting to write more data than indicated error. I cannot find a worthwhile explanation for this error - what does it mean?
    Here is my sample program.
    #include <oci.h>
    #include <stdio.h>
    #define CMN_IO_BUFF_SIZE 4096
    EXEC SQL INCLUDE sqlca.h;
    EXEC SQL INCLUDE oraca.h;
    EXEC SQL BEGIN DECLARE SECTION;
    VARCHAR f_Conn[100];
    EXEC SQL END DECLARE SECTION;
    int main () {
    OCIBlobLocator *DbBlob;
    FILE          *Fp;
    int          FirstRead;
    unsigned int     BytesRead;
    unsigned int     Offset;
    unsigned char     IoBuff[CMN_IO_BUFF_SIZE];
    strcpy ( f_Conn.arr, "isis_app/isis_app@isisdev1" );
    f_Conn.len = strlen ( f_Conn.arr );
    EXEC SQL VAR IoBuff IS RAW ( CMN_IO_BUFF_SIZE );
    printf ( "VAR returned error %d\n", sqlca.sqlcode );
    printf ( " %s\n", sqlca.sqlerrm.sqlerrmc );
    EXEC SQL CONNECT :f_Conn;
    printf ( "CONNECT returned error %d\n", sqlca.sqlcode );
    printf ( " %s\n", sqlca.sqlerrm.sqlerrmc );
    EXEC SQL ALLOCATE :DbBlob;
    printf ( "ALLOC returned error %d\n", sqlca.sqlcode );
    printf ( " %s\n", sqlca.sqlerrm.sqlerrmc );
    EXEC SQL INSERT INTO lob_table (a_blob)
    VALUES (EMPTY_BLOB())
    RETURNING a_blob INTO :DbBlob;
    printf ( "INSERT returned error %d\n", sqlca.sqlcode );
    printf ( " %s\n", sqlca.sqlerrm.sqlerrmc );
    Fp = fopen ( "test.gif", "r" );
    if ( Fp != 0 ) {
    FirstRead = 1;
    Offset = 1;
    BytesRead = CMN_IO_BUFF_SIZE;
    while ( BytesRead > 0 ) {
    printf ( "Bytes requested %d\n", BytesRead );
    BytesRead = fread ( IoBuff, 1, BytesRead, Fp );
    printf ( "Bytes read %d\n", BytesRead );
    if ( ( FirstRead == 1 ) && ( BytesRead < CMN_IO_BUFF_SIZE ) ) {
    EXEC SQL LOB WRITE ONE :BytesRead
    FROM :IoBuff INTO :DbBlob AT :Offset;
    printf ( "WRITE ONE returned error %d\n", sqlca.sqlcode );
    printf ( " %s\n", sqlca.sqlerrm.sqlerrmc );
    printf ( "Bytes written %d at offset %d\n", BytesRead, Offset );
    } else if ( ( FirstRead == 1 ) && ( BytesRead == CMN_IO_BUFF_SIZE ) ) {
    EXEC SQL LOB WRITE FIRST :BytesRead
    FROM :IoBuff INTO :DbBlob AT :Offset;
    printf ( "WRITE FIRST returned error %d\n", sqlca.sqlcode );
    printf ( " %s\n", sqlca.sqlerrm.sqlerrmc );
    printf ( "Bytes written %d at offset %d\n", BytesRead, Offset );
    } else if ( ( FirstRead == 0 ) && ( BytesRead == CMN_IO_BUFF_SIZE ) ) {
    EXEC SQL LOB WRITE NEXT :BytesRead
    FROM :IoBuff INTO :DbBlob AT :Offset;
    printf ( "WRITE NEXT returned error %d\n", sqlca.sqlcode );
    printf ( " %s\n", sqlca.sqlerrm.sqlerrmc );
    printf ( "Bytes written %d at offset %d\n", BytesRead, Offset );
    } else if ( ( FirstRead == 0 ) && ( BytesRead < CMN_IO_BUFF_SIZE ) ) {
    EXEC SQL LOB WRITE LAST :BytesRead
    FROM :IoBuff INTO :DbBlob AT :Offset;
    printf ( "WRITE LAST returned error %d\n", sqlca.sqlcode );
    printf ( " %s\n", sqlca.sqlerrm.sqlerrmc );
    printf ( "Bytes written %d at offset %d\n", BytesRead, Offset );
    FirstRead = 0;
    Offset = Offset + BytesRead;
    if ( BytesRead < CMN_IO_BUFF_SIZE ) {
    BytesRead = 0;
    fclose ( Fp );
    } else {
    printf ( "Error opening input file\n" );
    EXEC SQL COMMIT WORK;
    printf ( "COMMIT returned error %d\n", sqlca.sqlcode );
    printf ( " %s\n", sqlca.sqlerrm.sqlerrmc );
    }

    Do not use buffered IO (FILE*) . Use direct Calls(Open/Write).
    Buffered IO has limiations

Maybe you are looking for

  • SQL connection errors when stress testing mobile service: SQL failure after 3 attempts

    I have created a Mobile Service (node.js), which has been running for a few months with 50-100k api calls per day with no issues. The usage of the service will be scaled up soon, and it will receive much higher traffic, so I am running stress tests (

  • Flash Builder 4 - Beta / Design view sporadic at best

    Okay, so I have installed the beta, and running through the Catalyst / Flash BUilder 4 tutorial, all is well, unitl i try to get the imprted fxp file to consistently display in the design mode. Not only that, but switching from code view to design vi

  • How to pass data back to MS CRM online from Azure SB with two-way listener?

    Hi all, I have already setup the integration between MSCRM Online 2015 and Azure using two-way listener.  However, I am unable to retrieve the return string "Success" in MSCRM side, such as System Jobs.  Anyone has idea?  Thanks. https://technet.micr

  • 500 internal error:lisntner returned error

    Hi All, I m new to this forum, Please help me. I`m using Oracle Application Server 10gR2 version 10.1.2.3 and my portal version is 10.1.4.2 and database version is 10.2.0.4 and it is 32-bit system. I imported dump from other application server with s

  • ECC 5 Database LOAD Error

    Hi GURUs, I got following error in ECC 5 @ database Load steps, Can any body help me out how to slove it, ERROR 2006-07-29 11:11:49 MSC-01015 Process finished with error(s), check log file H:\Program Files\sapinst_instdir\ECC04SR1\WEBAS_ABAP_ORA_NUC\