Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Help: ConText in Pro*C

Re: Help: ConText in Pro*C

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 1997/06/19
Message-ID: <33b190f3.23062482@newshost>#1/1

On Thu, 19 Jun 1997 15:02:30 -0400, Leonid Lamburt <leonid_at_cs.bu.edu> wrote:

>I am trying to use ConText CONTAINS clause in C code (7.3.3.0.0)
>
>Something like:
> EXEC SQL SELECT COUNT(*) INTO :emp_count
> FROM emp
> WHERE CONTAINS(emp_name, :some_string) > 0;
>
>PRO*C precompiler (2.2.3.0.0) fails with:
> PCC-S-02201, identifier 'CONTAINS' must be declared
>

Do it like this:


exec sql begin declare section;

    int n;
    VARCHAR some_string[255];
exec sql end declare section;  

    EXEC SQL WHENEVER SQLERROR DO sqlerror_hard();  

    EXEC SQL ALTER SESSION SET TEXT_ENABLE=TRUE;     printf( "I altered the session\n" ); fflush(stdout);  

    strcpy( some_string.arr, "oracle" );     some_string.len = strlen(some_string.arr);  

    EXEC SQL DECLARE C1 CURSOR FOR

         SELECT COUNT(*)
           FROM text
          WHERE CONTAINS(text, :some_string) > 0;
 

    EXEC SQL OPEN C1;
    EXEC SQL FETCH C1 INTO :n;
    EXEC SQL CLOSE C1;       printf( "There are %d documents containing that\n", n );fflush(stdout);


AND DON'T use sqlcheck=full or semantics (don't have proc log into the database). Pro*C attempts to parse the query when this is on, it doesn't understand contains().

>I couldn't find any examples in Oracle demos, but they claim
>on their Web site that "a variety of standard tools can be used, such
>as Developer/200, Oracle Power Objects and Pro*C"
>
>If anybody knows the answer, please respond to leonid_at_cs.bu.edu
>
>(I can't get any response from Oracle Tech. Support so far)
>
>Thanks in advance
>
>Leonid

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Bethesda MD

http://govt.us.oracle.com/ -- downloadable utilities



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Thu Jun 19 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US