58
Views
9
Comments
Solved
Unexpected SQL Unexpected '?' in SQL statement of GetCastAndCrew. Recheck the SQL to
Question

What ever I try I see the above error message. I copy text or type it myself. 

Anyone a hint where to look ? 


I will include both my .oml files 


Roelof


OSMDbCoreRW.oml
2019-06-15 21-39-22
Afonso Carvalho
 
MVP
Solution

Hey Roelof,

I think it might be a problem with Unicode characters: did you copy the query directly from this thread page?

All spaces (U+0020) are showing as zero-width spaces (U+200B), and it might be confusing the true-change parser and giving you a warning.

Try writing Benjith's query by hand in your advanced query, and it should go away.

UserImage.jpg
Roelof Wobben

and here the second : 

OSMDbRW.oml
2019-06-15 21-39-22
Afonso Carvalho
 
MVP

Hi Roelof,

Doing advanced queries with a SELECT * is dangerous - the order of the fields within can change and cause errors.

Even with that, you're trying to cast the result of SELECT * FROM {PERSON} into a structure with different fields (PersonId and Fullname - these don't match with the fields of the Person Entity). Try changing your query to something like this:

SELECT {Person}.[Id], CONCAT({Person}.[Name], ' ', {Person}.[SurName])
FROM {Person}


UserImage.jpg
Roelof Wobben

Thanks,  I try that to find out where my error was coming from. Even with your sql  I see this warning :

Unexpected SQL

Unexpected '' in SQL statement of GetCastAndCrew. Recheck the SQL to make sure it is valid


and still I cannot find where its coming from. IM following the web programm course. 


I rechecked also all variables have the right type and that seems to be.

2021-03-18 21-03-15
Benjith Sam
 
MVP

Hi Roelof,

OutSystems best practice recommends to use Aggregate instead of Advance Query (You can achieve the same with Aggregate - Just for info).

 


SyntaxEditor Code Snippet

SELECT {Person}.[Id], {Person}.[Name] + ' ' + {Person}.[Surname]
FROM {Person} 
INNER JOIN {PersonMovieRole} 
    ON {Person}.[Id] = {PersonMovieRole}.[PersonId]
WHERE 
{PersonMovieRole}.[PersonRoleId] = @PersonRole 
and {PersonMovieRole}.[MovieId] = @MovieId


Hope it helps.


Kind Regards,

Benjith Sam

UserImage.jpg
Roelof Wobben

I know but the web development course wants me to teach it with SQL :( 

UserImage.jpg
Roelof Wobben

wierd, I get the warning but all seems to be working right. Did I maybe hit a big in the beta version or is there someting wrong what I cannot see. 


I will include my last version 

OSMDbRW.oml
2019-06-15 21-39-22
Afonso Carvalho
 
MVP
Solution

Hey Roelof,

I think it might be a problem with Unicode characters: did you copy the query directly from this thread page?

All spaces (U+0020) are showing as zero-width spaces (U+200B), and it might be confusing the true-change parser and giving you a warning.

Try writing Benjith's query by hand in your advanced query, and it should go away.

UserImage.jpg
Roelof Wobben

it did not. I typed in : 

SyntaxEditor Code Snippet

SELECT {Person}.[Id] FROM {Person}


and still this annyoing warning 


Even if I have no sql  in that part I see the error. 


Roelof


2019-06-15 21-39-22
Afonso Carvalho
 
MVP

Did you delete the Advanced Query itself and then recreate it? I noticed it's very hard to stop it from recognising the characters once it happens. 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.