select (select pid
from product_maintain pm
where pm.product_number = ph.product_number
and pm.rstate = ph.r_state)
from pack_history ph
where ph.sn = p_serial_num
and rownum <= 1) in
(select child_pid
from product_level pl
where pl.pid = (select pid
from work_order wo
where wo.order_type = 'DPY'
and wo.line_id = p_line_id
and wo.order_state = 1))這樣的sql﹐你們覺得跟表直接關聯﹐在效能方面差別大嗎?也就是用表關聯和這種子查詢在效能差大嗎?
哪種更好點?
from product_maintain pm
where pm.product_number = ph.product_number
and pm.rstate = ph.r_state)
from pack_history ph
where ph.sn = p_serial_num
and rownum <= 1) in
(select child_pid
from product_level pl
where pl.pid = (select pid
from work_order wo
where wo.order_type = 'DPY'
and wo.line_id = p_line_id
and wo.order_state = 1))這樣的sql﹐你們覺得跟表直接關聯﹐在效能方面差別大嗎?也就是用表關聯和這種子查詢在效能差大嗎?
哪種更好點?
select count(1)
----into v_allowance
from dual
where (select (select pid
from product_maintain pm
where pm.product_number = ph.product_number
and pm.rstate = ph.r_state)
from pack_history ph
where ph.sn = 'BX900000YQ'
and rownum <= 1) in
(select child_pid
from product_level pl
where pl.pid = (select pid
from work_order wo
where wo.order_type = 'DPY'
and wo.line_id = 'DL1'
and wo.order_state = 1))