Converting PBSELECT Query to standard SQL Query

551 views Asked by At

I want to convert Powebuilder generated query into Standard Sql ,I tried and I did but I have doubt at few points.

POWER BUILDER QUERY:

 PBSELECT( VERSION(400) TABLE(NAME=~"part~" ) 
       COLUMN(NAME=~"part.part_no~") 
       COLUMN(NAME=~"part.part_id~")
       WHERE(EXP1 =~"part.part_no~" OP =~"=~" EXP2 =~":p_part_no~" ) ) 
       ARG(NAME = ~"p_part_no~" TYPE = string)"

STANDARD SQL CONVERTED QUERY:

SELECT 
    part.part_no ,
    part.part_id FROM part  
    WHERE :EXP1 = part.part_no  OR :EXP2 =  p_part_no

I converted this query but I am not able to understand the variables: EXP1, EXP2 p_part_no & OP. If I look on the POWER BUILDER Query then only one argument is there but then what is EXP1 , EXP2 ,p_part_no and OP from where its values come.

Any suggestion and help will be appreciated.

1

There are 1 answers

3
Heino Hellmers On BEST ANSWER

please check your standard sql ( converted )

Op = operator to use

Exp1 = left side

Exp2 = right side

So in your case i would expect the converted pbselect is more like

select ...where p_part_no = :p_part_no

build from your given pbselect statement

In this case the argument you use to retrieve is p_part_no

In your converted SQL you show a "or" as operator ... This is not in the pbselect, so i would expect that you could have mixed your different test cases?

I didn't check back this in pb, but can do it if this is not the correct answer.