当前位置:网站首页>Execute immediate simple sample set (DML)
Execute immediate simple sample set (DML)
2022-07-29 00:43:00 【Yun Wenwu】
With uncertain parameters DML
- increase
-- To write pl/sql The program block implements the insertion of user input data dept surface
declare
v_deptno dept.deptno%type:=& Please enter the department number ;
v_dname dept.dname%type:='& Please enter the Department name ';
v_loc dept.loc%type:='& Please enter the Department Address ';
begin
execute immediate 'insert into dept values(:a,:b,:c)' using v_deptno,v_dname,v_loc;
end;

- Delete
-- To write pl/sql The block implementation will dept The data corresponding to the department number entered by the user in the table is deleted
declare
c number:=& Please enter the department number to delete the information ;
begin
execute immediate 'delete from dept where deptno=:a' using c;
end;

- Change
-- Write a pl/sql The code block implements setting the employee's salary to 1000
declare
v_empno emp.empno%type:=& Please enter the employee number ;
begin
execute immediate 'update emp set sal=1000 where empno=:a' using v_empno;
end;

- check
-- Write a pl/sql The code block realizes querying the number of people in the table according to the table name entered by the user , And print
Declare
a NUMBER;
v_table varchar2(20):='& Please enter a table name ';
v_sql Varchar2(100);
BEGIN
v_sql:='select count(*) from '||v_table;
Execute Immediate v_sql INTO a;
dbms_output.put_line(v_table||'--------'||a);
END;

边栏推荐
- [untitled]
- 最长上升子序列
- 手把手教你安装Latex(保姆级教程)
- vulnhub:SolidState
- Dynamic programming problem (6)
- 动态规划问题(六)
- [develop low code platform] low code rendering
- PTA (daily question) 7-70 diamond
- PTA (one question per day) 7-76 ratio
- Some operations of Ubuntu remote server configuration database (unable to locate package MySQL server, steps of installing mysql, unable to enter password when logging in MySQL)
猜你喜欢

芯驰科技发布G9系列最新旗舰产品,配备6个1.8Ghz主频的A55核心

Laravel permission control

PTA (daily question) 7-77 encryption

MySQL sub database and sub table and its smooth expansion scheme

15.模型评估和选择问题

Outlier detection and Gan network (1)

Use hutool tool class to operate excel with more empty Sheet1

Locally connect to redis on Windows Server

Outlier detection and open set identification (1)

Software designer afternoon question
随机推荐
动态规划问题(六)
IMG tags prohibit dragging pictures
NPM run serve stuck at 40%
Upload Excel files with El upload and download the returned files
vulnhub:BTRSys2
【MySQL 8】Generated Invisible Primary Keys(GIPK)
@Detailed explanation of postconstruct annotation
Common sparse basis and matlab code for compressed sensing
芯驰科技发布G9系列最新旗舰产品,配备6个1.8Ghz主频的A55核心
Common measurement matrix and matlab code of compressed sensing
【esn】 学习回声状态网络
刷题的第三十天
Flask sends verification code in combination with Ronglian cloud
[basic course of flight control development 8] crazy shell · open source formation uav-i2c (laser ranging)
1331. Array sequence number conversion: simple simulation question
Dynamic programming problem (VII)
面试被问到了String相关的几道题,你能答上来吗?
vulnhub:Sar
Software designer afternoon question
Dynamic programming (V)