Home » SQL & PL/SQL » SQL & PL/SQL » need an answer from experts
need an answer from experts [message #35657] Thu, 04 October 2001 06:15 Go to next message
Venky
Messages: 52
Registered: October 2001
Member
I got this function from oracle manual
to read a CLOB from a table
My question once the data is read, how to copy that data to local (char *) vairable.Iam able to print the data to standard out, the big question is how to capture that data into a variable.
Appreciate any ones help
int main()
{

EXEC SQL ALLOCATE :a_clob;

EXEC SQL SELECT CLOB INTO :a_clob
FROM emp
WHERE empId = 12345
to_char(emp_clddate, 'DD-MM-YY')
= '23-SEP-01';
EXEC SQL LOB DESCRIBE :a_clob GET LENGTH INTO :lenp;
if(lenp == 0)
printf("n No record found. n");
else
{
EXEC SQL BEGIN DECLARE SECTION;
int amt = lenp;
varchar *the_string;
EXEC SQL END DECLARE SECTION;
the_string = (varchar *)malloc(2 + lenp);
the_string->len = (int)lenp;

EXEC SQL WHENEVER NOT FOUND CONTINUE;
EXEC SQL LOB READ :amt
FROM :a_clob INTO :the_string WITH LENGTH :lenp;

printf("n------------------------------------------------------------------------------------nn");

printf("%.*sn", the_string->len,string->arr);
printf("n------------------------------------------------------------------------------------nn");
free(the_string);

}
EXEC SQL FREE :a_clob;

}

----------------------------------------------------------------------
Re: need an answer from experts [message #35665 is a reply to message #35657] Thu, 04 October 2001 11:39 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
have you checked this out??
http://technet.oracle.com/doc/oracle8i_816/appdev.816/a77001.pdf

----------------------------------------------------------------------
Previous Topic: quick question
Next Topic: DBMS_TCP and DBMS_SMTP packages
Goto Forum:
  


Current Time: Sat May 25 09:00:16 CDT 2024