Search This Blog

Wednesday, January 30, 2013

%P(1) in SQL object

The %P(1) refers to the first parameter of SQL definition.

Example: Below view retrieves EMPLID,NAME and EMAIL_ADDRESSES from two tables PS_NAMES and PS_EMAIL_ADDRESSES.

SQL Definiton VC_EMP_NM => %P(1).EMPLID,%P(1).NAME,%P(2).EMAIL_ADDRESS

VC_EMP_NM is the SQL definition which is referenced in SQL Editor as
select %SQL(VC_EMP_NM,NM,EML) from PS_NAMES NM, PS_EMAIL_ADDRESS EML
where NM.EMPLID=EML.EMPLID

NM -- 1st Param nothing but alias of PS_NAMES record
EML -- 2nd Param nothing but alisa of PS_EMAIL_ADDRESS record

which is resolved into
select NM.EMPLID,NM.NAME,EML.EMAIL_ADDRESS from PS_NAMES NM, PS_EMAIL_ADDRESS EML
where NM.EMPLID=EML.EMPLID

Below is the snapshot.



 





No comments: