buntatsu / cdt-proc

Eclipse CDT extension for Oracle Pro*C
Eclipse Public License 1.0
26 stars 7 forks source link

Use of .COUNT method on variable not recognized #23

Open chrisallen21 opened 8 years ago

chrisallen21 commented 8 years ago

Consider the following code (where tableOfData is an output parameter on the stored procedure): int numArrayCount;

EXEC SQL BEGIN DECLARE SECTION;
    varchar tableOfData[10][10 + 1];
EXEC SQL END DECLARE SECTION;

    EXEC SQL EXECUTE
    BEGIN
        Some_Stored_Procedure
        (
            :tableOfData,
        );

        :numArrayCount := :tableOfData.COUNT;
    END;
    END-EXEC;

Currently, the editor will report 'COUNT could not be resolved' and flag as a compile time error.

If I adjust the code to surround the variable with round brackets (as shown below), the syntax error goes away: :numArrayCount := (:tableOfData).COUNT;

I suspect it is because the editor does not recognize the PL/SQL COUNT method as demonstrated here: http://dba.stackexchange.com/questions/11475/pl-sql-best-way-to-count-elements-in-an-array

buntatsu commented 7 years ago

Sorry for too late reply.

cdt-proc does not parse SQL block. It just detects host variables and hands over to cdt. Therefore, cdt-proc can not cope well with this kind of code.

I wish I could come up with something to deal with.