Weird Oracle error

Posts   
 
    
Posts: 497
Joined: 08-Apr-2004
# Posted on: 08-Feb-2005 11:35:52   

Hi Frans,

I have a simple "custom typed list"....

                RelationPredicateBucket bucket;
                // Define the fields that we want to return.
                ResultsetFields fields = new ResultsetFields(4);
                fields.DefineField(Corporate_PolicyFieldIndex.ID, 0, "ID", "Corporate_Policy");
                fields.DefineField(Corporate_PolicyFieldIndex.LastUpdate_Date, 1, "LastUpdate_Date", "Corporate_Policy");
                fields.DefineField(Corporate_PolicyFieldIndex.Sequence_No, 2, "Sequence_No", "Corporate_Policy");
                fields.DefineField(Corporate_PolicyFieldIndex.Title, 3, "Title", "Corporate_Policy");
                
    
                bucket = new RelationPredicateBucket();
                bucket.PredicateExpression.Add (PredicateFactory.CompareValue(Corporate_PolicyFieldIndex.ID, ComparisonOperator.Equal, 0, "Corporate_Policy"));
    
                adaptor.FetchTypedList(fields, dt, bucket, 0, null, true);

Which generates this SQL in good ol' Oracle....

SELECT "Corporate_Policy"."ID" AS "ID","Corporate_Policy"."LASTUPDATE_DATE" AS "LastUpdate_Date","Corporate_Policy"."SEQUENCE_NO" AS "Sequence_No", "Corporate_Policy"."TITLE" AS "Title" FROM "ENVOY"."CORPORATE_POLICY" AS "Corporate_Policy" WHERE ( "Corporate_Policy"."ID" = 0)

Which gives this error from Oracle....

ORA-00933: SQl command not properly ended. (It points to the part of the SQL I made bold).

Whats wrong here? The sql looks ok? Why the error?

Posts: 497
Joined: 08-Apr-2004
# Posted on: 08-Feb-2005 11:48:13   

Hmmmm, I don't think you can alias tables in oracle.....frans?

Posts: 497
Joined: 08-Apr-2004
# Posted on: 08-Feb-2005 12:12:32   

Sure enough, if I ditch the "Corporate_Policy" alias from the code then it all works fine. Thats OK for a fix, but I don't know why the generated code decided to alias the table in the SQL like it did.....

Also, in other places where I use a dynamic list and join 2 tables using table aliases, i don't come across this problem.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 08-Feb-2005 12:38:24   

Clearly a bug in the Oracle DQE. When you use relations, the FROM clause is produced by a different routine than when you don't specify relations.

I'll check it out.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 497
Joined: 08-Apr-2004
# Posted on: 08-Feb-2005 12:39:49   

Thanks Frans wink

As I said I can work round it nicely for now - so I'm in no panic!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 08-Feb-2005 12:53:47   

Well, it's a bug which isn't that likely to happen at the moment because typed lists don't have aliasses, but will be soon, so I've fixed it (removing 'AS' from the query simple_smile ).

Please grab the hotfix for the runtime libs from the website simple_smile

Frans Bouma | Lead developer LLBLGen Pro