-2

i,m working on my first delphi script and when i want to run it there is an '; expected' error but i dont know why. When i click on the error the cursor jumps to the location where the error appears but that's two lines below the end of the code What's wrong?

var   
   stringName : String;
   stringBase : String;         

procedure setPicturePath();
var      
    qryPicEncode : TOraQuery;
    qryPicDecode : TOraQuery; 
begin
    qryPicEncode := TOraQuery.Create(nil);
    qryPicEncode.SQL.Text := 'select ''utl_raw.cast_to_varchar2(utl_encode.base64_encode(utl_raw.cast_to_raw("werner weilenmann"))) from dual';
    qryPicDecode := TOraQuery.Create(nil);
    qryPicDecode.SQL.Text := 'select ''utl_raw.cast_to_varchar2(utl_encode.base64_decode(utl_raw.cast_to_raw("d2VybmVyIHdlaWxlbm1hbm4="))) from dual';                                                    

    qryPicEncode.open;
    qryPicEncode.first;
    if not(qryPicEncode.eof) then begin
        stringName := qryPicEncode.fieldByName('pic4Path').AsString;
    end;
    qryPicDecode.open;
    qryPicDecode.first;
    if not(qryPicDecode.eof) then begin
       stringBase := qryPicDecode.fieldByName('ODACQuery1').AsString;
    end;
    qryPicEncode:=nil;              
    qryPicDecode:=nil;                                         
end;  


begin
    //Picture2.LoadFromFile('U:\Documents\logos\logo1.png');              
    setPicturePath();
    showmessage(stringName);
    showmessage(stringBase);          
end.
10
  • You haven't shown enough code to answer what's causing the ; expected error. Since the compiler thinks the error is past your actual code, it maybe that you have wrong End-Of-Line characters in parts of your code. This may happen when you copy code from the net. Which Delphi version are you working with? Oct 21, 2019 at 10:15
  • 2
    There seem to be some other errors too. In the lower begin - end block you call setPicturePath which on its end sets qryPicEncode:=nil and qryPicDecode:=nil. At the time the execution returns to the lower begin - end block, your code continues with a call to showmessage(qryPicEncode);. What do you expect the ShowMessage() dialog to show you? Secondly, qryPicEncode and 'qryPicDecode' are local variables in procedure setPicturePath, they are not even visible to the lower begin - end block. Oct 21, 2019 at 10:15
  • Take a look at this answer for an explanation when a wrong End-Of.Line character may offset line numbers of code. It explains it in conjunction of the executable lines (where breakpoints may be put) , but causes similar line number errors otherwise too. Oct 21, 2019 at 10:26
  • i've edit it and now i get a 'quoted string not properly terminated' exception.
    – DoFlamingo
    Oct 21, 2019 at 10:55
  • i want to display the name Base64 encoded and decoded
    – DoFlamingo
    Oct 21, 2019 at 10:56

1 Answer 1

1

Seems you have some errors with begin/end's.

Here:

begin
    setPicturePath();
    showmessage(qryPicEncode);
    showmessage(qryPicDecode);                                      
end;

you refer to variable qryPicEncode local to setPicturePath(); procedure - but this code chunk is outside of it...

Format source to reveal mistakes

2
  • changed it to stringBase and stringName but nothing changed same exception
    – DoFlamingo
    Oct 21, 2019 at 10:01
  • 1
    Usage of local variables might point that you have shown not real code.
    – MBo
    Oct 21, 2019 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.