Label:The first is the problem of fuzzy query, I started with the following conditions: SELECT * from the user where name like '% #value #% '. But how can not, as if also reported wrong. Later on the internet found a solution, is to use $ to replace the # number.1> write: Like '% $value $% ' can be,2> also found another method, but that method I tried for a long time, is not, the method is: like '% ' | | #value # | | '% ', the query came out of the results are actually all. Later on the internet
Pro * C has three common dynamic SQL technologies:
It is used to process dynamic SQL statements that do not contain host variables and cannot be used for select statements.
It is used to process the dynamic SQL statements with
Oracle dynamic SQL statements
Dynamic SQL return cursor:
Create or replace procedure partition (p_regioncode in number, p_pscode in number, p_outputcode in number, p_pollutantType in number, Region in varchar2, p_attencode in varchar2, p_checkstatus in number, p_auditstatus
Oracle + mybatis uses dynamic SQL to implement batch insert when the inserted fields are uncertain. oraclemybatis
Recently, the project encountered a very tangled problem. Due to the business relationship, the database data table cannot be determined, and fields may be added during use, this causes a lot of trouble to me during insert.
First, let's take a look at
Oracle dynamic SQL, oraclesql
The syntax for executing dynamic SQL statements is:
Excute immediate dynamic SQL statement using binding parameter list returning into output parameter l
Tags: blog io ar sp on log BS asThe syntax for executing dynamic SQL is:Excute immediate Dynamic SQL statement using-bound parameter list returning into output parameter listTest table: Table: Student (id,name,age);Example: StorageCreate or Replace procedure P_stu_info (s_id number) is v_name varchar2 (n); V_age num
Dynamic SQL returns cursors:Create or Replace procedure Proc_validityduequery (P_regioncode in number, p_pscode in number, p_o Utputcode in number, p_pollutanttype in number, P_psclasscode in Varchar2, P_attencode in Varchar2, P_checkstatus in number, p_auditstatus in number, p_cursor out curdata) as begin open P_curso R for ' Select Bs.regioncode, Bs.regionname, Bs.pscode, Bs.psname, BS.
Oracle stored procedure: cursor and dynamic SQL 1. create package + CURSOR SQL code CREATE OR REPLACE PACKAGE RefCursor IS type t_RefCursor IS ref CURSOR; END RefCursor; 2. create a stored procedure and define the in and out parameters. SQL code create or replace PROCEDURE p
Dynamic SQL of stored procedures in the ORACLE package --- create or replace package test_pkg is g_public_flag varchar2 (1); function test_function (p_param1 varchar2, p_param2 varchar2) return varchar2; function hello_function (p_param3 varchar2) return varchar2; procedure ff (p1 varchar2); end; -- create or replace package body test_pkg is g_private_flag varcha
Although Oracle's dynamic SQL statements are really handy to use, the process of assembling them is cumbersome. Especially when the date Type field is involved in the Assembly statement, the Assembly should be added To_char first to the character, in the SQL, and then use To_date to convert to date type and the original field to compare.
For example, there is an
Label: --Create a result temp table at the transaction level
CreateGlobalTemporary TableTmp_yshy (C1varchar2( -), C2varchar2( -)
) on Commit Deleterows;--Create a temporary table that stores SQL statements at the transaction level
CreateGlobalTemporary TableTmp_sql (C1varchar2(4000)
) on Commit DeleteRows Test table: -- create table T_user (NAME varchar2 (20 number ) -- first build the package
Create or Replace Package Pack_user
as
--
Tags: des blog io color ar for data on 2014Dynamic SQL returns cursors:Create or Replace procedure Proc_validityduequery (P_regioncode in number, p_pscode in number, p_o Utputcode in number, p_pollutanttype in number, P_psclasscode in Varchar2, P_attencode in Varchar2, P_checkstatus in number, p_auditstatus in number, p_cursor out curdata) as begin open P_curso R for ' Select Bs.regioncode, Bs.regionname, Bs.pscode, Bs.psname, BS.
Lv_ SQL: ='Insert into etl_sucess_amountSelect seq_ OS _etl_amountid.nextval as amountid, 1, amount_data, amount_hour,Serviceid, portalid, mouduleid, actionid, reserve1_id, reserve2_id, reserve3_id,Reserve4_id, amount, amount_timeFrom(SelectTrunc (inserttime) as amount_data,To_char (inserttime, ''hh24'') as amount_hour,Serviceid, portalid, mouduleid, actionid,Null as reserve1_id,Null as reserve2_id,Null as reserve3_id,Null as reserve4_id,Count (*) as
How can I execute SQL statements in PLSQL stored procedures?
Use dynamic SQL Execution:Execute immediate
Table Information
Select * FromEmp_temp;
Stored Procedure
Create Or Replace Procedure F_delete_rows (table_name In Varchar2 , Condition In Varchar2 Default Null ) As Where_clause Varchar2 ( 100 ): = ' Whe
Simple development of PL/SQL stored procedures
Paging of stored procedure using dynamic SQL
procedure proc_goods_search_count(p_type number, p_keywords varchar2, p_number out number) is v_sql varchar2(4000);begin v_sql := ' select count(*) from lt_goods a
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.