oracle pl sql select into dynamic sql ตัวอย่าง Code
ตัวอย่าง ง่ายๆ ละกันนะครับ เช่น
เราต้องการเปลี่ยนจาก code ปรกติ
select code_id into v_code_id from mytable
ก็ให้ใช้
v_query_str := 'SELECT M'||v_month||'_TOTAL from mytable where f1=:bind_1 and f2=:bind_2 and f3=:bind_3';
EXECUTE IMMEDIATE v_query_str into v_result
USING v_1,v_2,v_3;