
CREATE TABLE bcd_ict_tkt_dropping_issue
 (
  seq_no                     NUMBER,
  al                         VARCHAR2(10),
  doc_number                 VARCHAR2(10),
  total_doc                  NUMBER,
  tax                        NUMBER,
  fee                        NUMBER,
  comm                       NUMBER,
  fp                         VARCHAR2(10),
  pax_name                   VARCHAR2(100),
  tc                         VARCHAR2(10),
  rloc                       VARCHAR2(10),
  trnc                       VARCHAR2(10),
  tkt_date                   DATE,
  in_etravel                 VARCHAR2(1),
  stock_stat                 VARCHAR2(1),
  tkt_issued                 DATE,
  tkt_voided                 DATE,
  tkt_voided_by              VARCHAR2(10)
 )
 PCTFREE    10
 PCTUSED
 INITRANS   1
 MAXTRANS   255
/

select * from bcd_ict_tkt_dropping_issue where in_etravel is null order by tkt_date

select tkt_date,TRNC, count(doc_number) from bcd_ict_tkt_dropping_issue where doc_number not in
(select ticket_number from id_ticket_details where ticket_date>'30-APR-2019')
and
trnc not in ('CANX','CNJ','RFNX','CANN')
and STOCK_STAT not in ('V')
 group by tkt_date, TRNC
order by tkt_date, TRNC

update bcd_ict_tkt_dropping_issue set in_etravel='Y' where doc_number in
(select ticket_number from id_ticket_details where ticket_date>'30-APR-2019') 

update bcd_ict_tkt_dropping_issue set in_etravel='Y' where TRNC in ('CANX','CNJ','RFNX','CANN')

SELECT * FROM ID_TICKET_STOCK_MASTER WHERE STOCK_TICKET='3030248356'

update bcd_ict_tkt_dropping_issue set STOCK_STAT='V' where DOC_NUMBER IN (SELECT STOCK_TICKET FROM ID_TICKET_STOCK_MASTER WHERE STOCK_STATUS='V' AND STOCK_RECEIVED>'01-may-2019' )

update bcd_ict_tkt_dropping_issue set TKT_ISSUED=
(SELECT STOCK_RECEIVED FROM ID_TICKET_STOCK_MASTER WHERE STOCK_TICKET=DOC_NUMBER AND ROWNUM=1),
TKT_VOIDED=
(SELECT STOCK_VOID FROM ID_TICKET_STOCK_MASTER WHERE STOCK_TICKET=DOC_NUMBER AND ROWNUM=1),
TKT_VOIDED_BY=
(SELECT tn_flex_2 FROM ID_TICKET_notes WHERE TN_TICKET_NUMBER=DOC_NUMBER AND ROWNUM=1)
 where DOC_NUMBER IN (SELECT STOCK_TICKET FROM ID_TICKET_STOCK_MASTER WHERE STOCK_STATUS='V' AND STOCK_RECEIVED>'01-may-2019' )

SELECT * FROM TAB WHERE TNAME LIKE '%TICKET%'

SELECT * FROM bcd_ict_tkt_dropping_issue where TRNC='TKTT' and STOCK_STAT='V' order by tkt_date
