<?xml version='1.0' encoding='UTF-8'?>
<ROWSET tableName='xxx'>
/****************************************************************************/
/* SYSTEM_ID : GE                                                           */
/* LPAD2 ( FUNCTION )                                                       */
/* Created : 2017/06/02 17:21:59                                            */
/****************************************************************************/
<EXEC_SQL>
CREATE     
FUNCTION LPAD2(
 XTEXT       IN VARCHAR2 ,
 XLEN        IN NUMBER   ,
 XVAL        IN VARCHAR2 := &apos; &apos; )
RETURN VARCHAR2
AS
    TEMP VARCHAR2(4000);
BEGIN
 IF LENGTHB(XTEXT) &gt; XLEN THEN
  RETURN SUBSTRB( XTEXT,1,XLEN );
 ELSE
  TEMP := LPAD( XTEXT,XLEN,XVAL );
  RETURN SUBSTRB( TEMP,LENGTHB(TEMP)-XLEN+1, XLEN ) ;
 END IF;
END LPAD2;

</EXEC_SQL>
</ROWSET>
