#用在储存过程中: create procedure k() begin declare number int; )); case number then select '>0'; else select '=0'; end case; end$ #用在查询中: select case user when 'root' then 'yes' else 'no' end from mysql.user;select case when user='root' then 'yes' else 'no…
循环结构 while create procedure name() begin while 条件 do SQL语句 end while; end$ create procedure aa6() begin ; do select number; ; end while; end$ mysql> create procedure aa6() -> begin -> declare number int default 0; -> w…
--if/else语句 if 条件 then SQL语句 else SQL语句elseifSQL语句 end if; create procedure test1( number int ) begin then select user(); else select 'please input a number > 10'; end if; end$ mysql> create procedure test1( -> number int -> ) -> begin then…
现在mysql上定义一个函数,一个储存过程 函数: delimiter \\ CREATE FUNCTION f2 ( num2 INT, num1 INT ) RETURNS INT BEGIN DECLARE a DEFAULT INT 1; SET a = num1 * num2; RETURN ( a ) ; END \\ delimiter; 函数式是计算两个值相乘的 在mysql的调用 select f2(9,5); -- 45 同时函数可以是配合select 函数 from 来使用…
储存过程 DELIMITER // CREATE PROCEDURE pro1() BEGIN SELECT book_id,book_name,category FROM bookinfo t1 JOIN bookcategory t2 ON t1.book_category_id = t2.category_id; END// DELIMITER ; DELIMITER // ),OUT num INT) BEGIN DELETE FROM reader_info WHERE card_id…
◆Oracle查询用户表空间:select * from user_all_tables ◆Oracle查询所有函数和储存过程:select * from user_source ◆Oracle查询所有用户:select * from all_users.select * from dba_users ◆Oracle查看当前用户连接:select * from v$Session ◆Oracle查看当前用户权限:select * from session_privs ◆Oracle查看用户表空间…
SQL获取所有数据库名.表名.储存过程以及参数列表 1.获取所有用户名:SELECT name FROM Sysusers where status='2' and islogin='1'islogin='1'表示帐户islogin='0'表示角色status='2'表示用户帐户status='0'表示糸统帐户2.获取所有数据库名:SELECT Name FROM Master..SysDatabases ORDER BY Name3.获取所有表名SELECT Name FROM Databas…
mysql安装过程中出现错误ERROR 1820 (HY000): You must SET PASSWORD before executing this statement解决 最近新装好的mysql在进入mysql工具时,总是有错误提示: # mysql -u root -p Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 或者 # mys…
存储过程 create or replace procedure TestPro(Descerr out varchar2 ) is begin select * from test; exception when others then Descerr :='接口表数据生成失败!'|| sqlerrm; end TestPro; job任务 ); begin--储存过程 TestPro(Descerr=>descerr); commit; end 视图 create or replace vi…