---
# System prepended metadata

title: 使用 SPI Detail 應用整理

---

# 使用 SPI Detail 應用整理

1. Cicada Pipeline:
    - Cpk: spi_data_2
        - 欄位：log_file_name, insert_db_date (幾乎都是同一天或跨一日)
		```
		select * from spi_detail_ht_v4
		where 1=1
		and insert_db_date >= substring('${base_time}', 1, 10)
		and insert_db_date <= substring('${batch_max_time}', 1, 10)
		and log_file_name in (${batch_log_file_name})
		```

2. Printer:
    - NPI
        - 欄位：log_file_name, insert_db_date (可能搜尋不同天，連續的一段時間)
        ```
        select * from :SPI_DETAIL_T b1
        where 1 = 1
        AND b1.log_file_name in (select log_file_name from spi_boardinfo)
        AND b1.insert_db_date >= ':min_insert_db_date'
        AND b1.insert_db_date <= ':max_insert_db_date'
		```
        
    - ETL
        - 欄位：log_file_name, insert_db_date (幾乎都是同一天或跨一日)
        ```
        select * from :SPI_DETAIL_T b1
        where 1 = 1
        AND b1.insert_db_date in (:start_end_date_str)
        AND b1.log_file_name in (select log_file_name from spi_log_file)
        ```