0

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.

SOP
  • 773
  • 3
  • 9
  • 26

1 Answers1

2

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.

  • First of all thanx a lot for answering and providing this great explanation. Actually there was no OR operator I considered OP as OR. – SOP Jan 15 '17 at 18:08
  • please explain this statement COMPUTE(NAME=~"decode(:p_lang_cd, ~~~"01~~~", country.country_name_j, country.country_name_e) as country_name~") – SOP Jan 15 '17 at 18:25
  • `decode(:p_lang_cd, '01', country.country_name_j, country.country_name_e) as country_name` meaning if the argument `:p_lang_cd` is `'01'` then use `country.country_name_j` otherwise use `country.country_name_e` – Eric Glenn Jan 26 '18 at 20:47