SQL "Failed to extract INTO items" after compile

SQL “Failed to extract INTO items” after compile

If I run the method via ODBC in an interpreter it works.
If I use a compiler need to create an application it does not work.
Tested on 4D v16 R3 32bit/64bit and last build 4D v16.2 214584.

//4D method
C_LONGINT($0;$EAPT_COUNT)
C_LONGINT($EAPT_OD;$EAPT_DO)
$EAPT_OD:=20170801
$EAPT_DO:=20170801
SQL LOGIN(<>ConnectionLoginDataEntry;<>ConnectionLoginUserName;<>ConnectionLoginPasword;)
Begin SQL
SELECT COUNT (
)
FROM eapt
where eapt.dt_od_tp>=:$EAPT_OD
and eapt.dt_do_tp<=:$EAPT_DO
INTO :$EAPT_COUNT;
End SQL
SQL LOGOUT
$0:=$EAPT_COUNT

[]20370241;“Error INTO…”[/]

OS : Windows 10, 64bit, Czech
Product :4D - 4D Server
4D : 16 R3 32/64
4D : 16.2 Build 214584

Problem solved.
I try used SQL instead of local :$var process :var and work in the compiled version and app.

I am glad you solved your problem.

indeed, the point is explained in the documentation:

Note: In compiled mode, you cannot use references to local variables (beginning with the $ symbol).

http://doc.4d.com/4Dv16/4D/16.1/Overview-of-SQL-Commands.300-3374858.en.html

Thank you very much. :slight_smile: I was looking for a manual, but I did not find this paragraph :slight_smile:

Is it me, or I read this in the doc you mention:

: 4D Doc

Use of local variables in compiled mode
In compiled mode, you can use local variable references (beginning
with the $ character) in SQL statements under certain conditions:
You can use local variables within a Begin SQL / End SQL sequence,
except with the EXECUTE IMMEDIATE command;

so what :?: :!:

This is only valid for the internal Database, if you use an external database you mustn´t use local variables …

I also stumbled over it :-?
http://forums.4d.com/Post/DE/19401178/1/19401179

Peter

Sorry, I can’t reach the link you put in your answer :?:
But, if it’s true, it’s really NOT clear enought in the 4D documentation :frowning:

This was the answer of Thomas Maul (sorry - only German):

: Thomas MAUL

Die Doku beschreibt “Sending Queries to the 4D SQL Engine”. Da geht
es.
wenn Sie jedoch auf eine externen SQL Server zugreifen, geht es nicht.

Nur der Vollständigkeit halber: auch die Befehlssyntax kann völlig
unterschiedlich sein, hier gilt dann die Dokumentation des externen
Servers, nicht die von 4D.
Create Table if not exists funktioniert in 4D (oder z B. PostgreSQL),
nicht aber in Microsoft SQL Server.

Danke für Ihre Antwort :wink: