It is necessary to display the following query:
That is, if there is a product in reserve, you need to display the document number on it.
Request text for outputting pallets:
SELECT pal_num, pal_prod, prd_desc, (CASE loc_blocked WHEN 0 THEN pal_loc ELSE pal_loc ||' блок' END) pal_loc, rst_desc, pal_batch, pal_vin, pal_cert, awacs_core.to_oradate(pal_bbdate), loc_name, loc_zone, pal_owner, pal_qty cases, pal_sqty singles, decode(pal_alloc, 1, pal_qty, pal_pickqty) pcases, decode(pal_alloc, 1, pal_sqty, pal_saqty) psingles FROM AWACS_PALVIEW, AWACS_PRD, awacs_loc, awacs_rst WHERE PAL_CUST = 'DIAGEO' AND PRD_PROD = PAL_PROD AND loc_name = pal_loc AND RST_CODE = PAL_RSTCODE AND PAL_CUST = PRD_CUST ORDER BY pal_num How to make so that in the presence of packings in reserve not equal to zero, the substring with document number and quantity is displayed?
Request for bottom line:
SELECT wrk_docref, wrk_qty, wrk_sqty FROM AWACS_WRK Here are sample tables for a query.
create table AWACS_PALVIEW (pal_num INTEGER,pal_prod INTEGER,pal_qty INTEGER, PAL_SQTY INTEGER); INSERT INTO AWACS_PALVIEW (pal_num,pal_prod,pal_qty,pal_sqty) VALUES (712005,124353,0,0); INSERT INTO AWACS_PALVIEW (pal_num,pal_prod,pal_qty,pal_sqty) VALUES (712015,1242343,1,0); INSERT INTO AWACS_PALVIEW (pal_num,pal_prod,pal_qty,pal_sqty) VALUES (789445,104399,0,0); create table AWACS_WRK (wrk_docref INTEGER, WRK_PALNUM INTEGER,WRK_QTY INTEGER, WRK_SQTY INTEGER); INSERT INTO AWACS_WRK (WRK_DOCREF,WRK_PALNUM,WRK_QTY,WRK_SQTY) VALUES (99999,712015,1,0); --- **Query #1** SELECT PAL_NUM,PAL_PROD,PAL_QTY,PAL_SQTY FROM AWACS_PALVIEW; | PAL_NUM | PAL_PROD | PAL_QTY | PAL_SQTY | | ------- | -------- | ------- | -------- | | 712005 | 124353 | 0 | 0 | | 712015 | 1242343 | 1 | 0 | | 789445 | 104399 | 0 | 0 | --- It is necessary to output between the second and third line: From them on the invoice, WRK_DOCREF, WRK_QTY, WRK_SQTY
And at me it turns out that in the end the union
SELECT PAL_NUM,PAL_PROD,PAL_QTY,PAL_SQTY FROM AWACS_PALVIEW UNION SELECT 'Из них по накладной',WRK_DOCREF,WRK_QTY,WRK_SQTY FROM AWACS_WRK 
