Home > database > Create a stored procedure, the incoming parameters as a condition, the purpose is to generate a tabl
Create a stored procedure, the incoming parameters as a condition, the purpose is to generate a tabl
Time:09-21
The create or replace procedure ljy_dm_product ( Prod_id varchar2 )
V_prom_nbr varchar2 (50);
- v_offer_id varchar (50); The begin V_prod_id:=prod_id;
The create table ls_dm_product as The select Amy polumbo rod_id as prod_id_dm From the product a Where a. ast_upd & gt; To_date (' 20180920000000 ', 'yyyymmddhh24miss') And not the exists (select 1 from the product b where Amy polumbo rod_id=p. rod_id) And Amy polumbo rod_id=v_prod_id;
The exception The when others then Null; end; end;
CodePudding user response:
In the stored procedure you want to EXECUTE the create table operation with dynamic execution of SQL: EXECUTE IMMEDIATE 'create table aaa the select * from CCC'
According to your requirement you need to build an parameters such as v_sql varchar2 (1000); Then assigned to the parameters such as SQL v_sql:='create table' Finally executing the SQL EXECUTE IMMEDIATE v_sql Built so that you can complete a form in the middle of operation, to the parameter under the fu is a piece of his own ideas, or in part to depend on oneself
CodePudding user response:
In the process of storage DML can only use dynamic SQL
1/f, there is a little slip of the tongue, new V_SQL is not parameter variables