Link to home
Create AccountLog in
Avatar of finance_teacher
finance_teacher

asked on

Oracle -- easy variable setting ?

Below works when I commend out
   P_WONUM VARCHAR2(32000) := '1' || SELECT MAX(WO_NO) FROM ACTIVE_WORK_ORDER_TAB;

How can I get the above to work, so P_WONUM gets set ?
-----------------------------------------------------------------------------------------------------------
DECLARE
   NULLS_ VARCHAR2(32000) := NULL;
   
   --1, below fails
   P_WONUM VARCHAR2(32000) := '1' || SELECT MAX(WO_NO) FROM ACTIVE_WORK_ORDER_TAB;
   
   --2, below works
   P_WONUM2 VARCHAR2(32000) := '22122';
     
   DETAILS_ VARCHAR2(32000) := 'WO_NO'||CHR(31)||P_WONUM2 ||CHR(30)||'ROW_NO'||CHR(31)||'17'||CHR(30)||'COMPANY'||CHR(31)||'10'||CHR(30)||'DESCRIPTION'||CHR(31)||'test'||CHR(30)||'SIGN'||CHR(31)||''||CHR(30)||'SIGN_ID'||CHR(31)||''||CHR(30)||'ORG_CODE'||CHR(31)||'PVL'||CHR(30)||'CONTRACT'||CHR(31)||'PVL'||CHR(30)||'ROLE_CODE'||CHR(31)||''||CHR(30)||'PLAN_MEN'||CHR(31)||'1'||CHR(30)||'TEAM_CONTRACT'||CHR(31)||'PVL'||CHR(30)||'CATALOG_CONTRACT'||CHR(31)||'PVL'||CHR(30)||'CATALOG_NO'||CHR(31)||''||CHR(30)||'SALES_PRICE'||CHR(31)||''||CHR(30)||'DISCOUNT'||CHR(31)||''||CHR(30)||'DATE_FROM'||CHR(31)||''||CHR(30)||'DATE_TO'||CHR(31)||''||CHR(30)||'SALE_UNIT_PRICE'||CHR(31)||''||CHR(30);
BEGIN

    WORK_ORDER_ROLE_API.NEW__( NULLS_, NULLS_, NULLS_, DETAILS_, 'DO' );
END;
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer