Wednesday, April 30, 2014

Sleep Function Within PeopleCode – PeopleSoft

I discovered that there doesn’t appear to be any built in functionality to allow for a delay to be implemented within PeopleCode. Thankfully there are a couple of roundabout way you can go about doing this: 

#1: Works if you are sitting on an Oracle DB
/* The following code creates a 5 second delay using DBMS_LOCK.SLEEP */
&s = 5;
SQLExec("exec DBMS_LOCK.SLEEP(:1)", &s);
 
#2: Note that this method is not as efficient as DMBS_LOCK.SLEEP()
/* The following code creates a 5 second delay using the java sleep method */
&s = 5;
GetJavaClass("java.lang.Thread").sleep(1000 * &s);

No comments:

Post a Comment