Using bind variables with dynamic SELECT INTO clause in PL/SQL

前端 未结 5 1382
深忆病人
深忆病人 2020-12-01 02:30

I have a question regarding where bind variables can be used in a dynamic SQL statement in PL/SQL.

For example, I know that this is valid:

CREATE OR          


        
5条回答
  •  盖世英雄少女心
    2020-12-01 03:30

    In my opinion, a dynamic PL/SQL block is somewhat obscure. While is very flexible, is also hard to tune, hard to debug and hard to figure out what's up. My vote goes to your first option,

    EXECUTE IMMEDIATE v_query_str INTO v_num_of_employees USING p_job;
    

    Both uses bind variables, but first, for me, is more redeable and tuneable than @jonearles option.

提交回复
热议问题