Oracle给动态Sql传参

DECLARE
  v_date    DATE;
  v_result  VARCHAR2(200);
  v_sql     VARCHAR2(200);
  v_text    VARCHAR2(200);
  v_result2 VARCHAR2(200);
BEGIN
  v_date := SYSDATE;
  v_text := 'text';
  v_sql  := 'select to_char(:v_date,''YYYYMMDD''),:v_text from dual';
  EXECUTE IMMEDIATE v_sql
    INTO v_result, v_result2 
    USING v_date, v_text;
  dbms_output.put_line(v_result);
  dbms_output.put_line(v_result2);
END;
Oracle

我来吐槽

*

*