Monday, August 24, 2015

Concatenation of strings in application Engine using SQL

Please find the sample code to Concatenate using Application Engine SQL

UPDATE Table1 MAIN
  SET MAIN.PASSWD = (
 SELECT 'TXT'|| SUBSTR(REPLACE(NID.NATIONAL_ID %Comma '-' %Comma'') %Comma -4 ) || EXTRACT(YEAR
  FROM SYSDATE)
  FROM Table2  NID
 WHERE NID.EMPLID = MAIN.EMPLID
   AND NID.NATIONAL_ID_TYPE = 'PR')
 WHERE EXISTS(
 SELECT 'X'
  FROM Table2  NID1
 WHERE NID1.EMPLID = MAIN.EMPLID
   AND NID1.NATIONAL_ID_TYPE = 'PR')
   AND MAIN.PROCESS_INSTANCE = %ProcessInstance

IF NID.NATIONAL_ID=1234567
AND YEAR=2015

Then Output will be -->TXT12345672015

No comments:

Post a Comment