Use with to solve the problem of variable input parameters

Source: Internet
Author: User

Using with to solve the problem of variable input parameters multi-input parameters when selecting an input parameter, the input parameter volume is variable, generally achieved through dynamic SQL spelling where statement, this method is not safe, poor readability. We can use the with statement and table function of Oracle to implement the variable input parameter function.
-- Created on 2008-03-19 by Administrator
Declare
 -- Local variables here
IInteger;
V_tab insu_table;
Begin
 Select'31'Bulk Collect IntoV_tabFromDual;
P1 (v_tab );
 
End;
 
Create Or Replace TypeInsu_tableIs Table Of Varchar2(3 );
Create Or Replace ProcedureP1 (p_tab insu_table)Is
V_aVarchar2(20 );
Begin
WithDataAs(
Select*
From Table(P_tab ))
SelectAab001
IntoV_a
FromAb15
WhereAae140In(Select*FromData)
AndRownum = 1;

End;

Use the with statement to virtualize a dataset and access it as a table in the SELECT statement.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.