1. David Pylatuk
  2. PowerBuilder
  3. Thursday, 14 March 2024 13:18 PM UTC

Hello,

I am using PB2022 R3 and have a datawindow with a stored procedure as the source. When I do a retrieve on the datawindow it crashes PowerBuilder. The call to the stored procedure is:

 

EXECUTE ESS9982 3158069, "2020-01-01" , "@", 0 , "@" , "@" ,"@" ,"@";

 

When I run this from isql inside Powerbuilder it also fails. When I change the double quotes to single quotes and run it from isql in Powerbuilder it runs perfect.

EXECUTE ESS9982 3158069, '2020-01-01' , '@', 0 , '@' , '@' ,'@' ,'@';

 

My question is how do I have the datawindow do the same thing... basically put single quotes around the parameters instead of double quotes. Thank you.

 

David Pylatuk Accepted Answer Pending Moderation
  1. Friday, 15 March 2024 14:25 PM UTC
  2. PowerBuilder
  3. # 1

Thanks everyone, the actual syntax generated by the datawindow painter is:

 

1 EXECUTE dbaprod.ESS9982;0 :AN_A_ID, :AS_MIN_INJURY_DT, :AS_ERROR_MSG,:AN_SQLCODE,:AS_SQLMSG1,:AS_SQLMSG2,:AS_SP_RETURN_CODE,:AS_EXIT_POINT" arguments=(('AN_A_ID', number),('AS_MIN_INJURY_DT', string),('AS_ERROR_MSG', string),('AN_SQLCODE', number),('AS_SQLMSG1', string),('AS_SQLMSG2', string),('AS_SP_RETURN_CODE', string),('AS_EXIT_POINT', string))

 

 

Comment
  1. Andreas Mykonios
  2. Friday, 15 March 2024 14:29 PM UTC
That seems to be right.

Andreas.
  1. Helpful
  1. Miguel Leeuwe
  2. Friday, 15 March 2024 20:53 PM UTC
What calls my attention is that there's only ONE double quote (after as_exit_point). Is that correct?
  1. Helpful
  1. John Fauss
  2. Friday, 15 March 2024 21:36 PM UTC
David has inadvertently omitted the beginning of the source line in the exported DataWindow's source, because it states:

procedure="1 execute ...
  1. Helpful
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Friday, 15 March 2024 13:55 PM UTC
  2. PowerBuilder
  3. # 2

So in the original question, you are stating that:

EXECUTE ESS9982 3158069, "2020-01-01" , "@", 0 , "@" , "@" ,"@" ,"@";

is automatically generated by datawindow designer?

Andreas.

Comment
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Friday, 15 March 2024 13:53 PM UTC
  2. PowerBuilder
  3. # 3

Hi.

That's because in sql you normally enclose varchar in single quotes. That's the standard. You say:

select *
from cities
where city_name like 'NEW%';

not

select *
from cities
where city_name like "NEW%";

Double quotes are used for alias or to enclose column names or table names when there is a possibility they would be invalid.

Example:

select city name
from cities
where city name like 'NEW%';

The above statement is invalid because city name is not a valid column name (but some databases, like access, may allow it). In that case you have to enclose that column in double quotes:

select "city name"
from cities
where city name like 'NEW%';

Some query editors may allow you to change the behavior for both double and single quotes, but I don't believe this ok with sql standards.

Dates should be passed as strings in 'YYYY-MM-DD' format as you do. @ is a character, so the correct sql command is:

EXECUTE ESS9982 3158069, '2020-01-01' , '@', 0 , '@' , '@' ,'@' ,'@';

Andreas.

Comment
There are no comments made yet.
David Pylatuk Accepted Answer Pending Moderation
  1. Friday, 15 March 2024 13:00 PM UTC
  2. PowerBuilder
  3. # 4

It the datawindow painter I use no quotes at all for the retrieval arguments and the call fails, PB crashes. If I just run an EXECUTE statement with the parameters in single quotes the call succceeds

 

Comment
  1. Andreas Mykonios
  2. Friday, 15 March 2024 13:54 PM UTC
This would be wrong. You have to use single quotes.
  1. Helpful
  1. Miguel Leeuwe
  2. Friday, 15 March 2024 14:00 PM UTC
ok, sorry, maybe I was confused with a normal datawindow that doesn't use a stored procedure.

My apologies.
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Thursday, 14 March 2024 14:40 PM UTC
  2. PowerBuilder
  3. # 5

If you do a retrieve from the datawindow painter, you should use no quotes at all.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.