儲存過程4 查詢資料

2021-06-08 16:43:19 字數 923 閱讀 8968

drop procedure if exists proc_name;

delimiter //

create procedure proc_name (in parameter integer)

begin

if parameter=0 then

select * from student order by no asc;

else

select * from student order by height asc;

end if;

end;

//delimiter ;

call proc_name(0);

+--------+----------+--------+

| no | name | height |

+--------+----------+--------+

| 122654 | wangwu | 1.36 |

| 123654 | zhangsan | 1.56 |

| 129854 | lisi | 1.16 |

+--------+----------+--------+

call proc_name(5);

+--------+----------+--------+

| no | name | height |

+--------+----------+--------+

| 129854 | lisi | 1.16 |

| 122654 | wangwu | 1.36 |

| 123654 | zhangsan | 1.56 |

+--------+----------+--------+

查詢儲存過程

1.oracle中下面這麼寫 按名查詢儲存過程 select from user objects where object type procedure and object name like upper p 按內容查詢儲存過程 select from all source where type ...

儲存過程系列之儲存過程sql查詢儲存過程的使用

1.查詢某個表被哪些儲存過程 以下簡稱 sp 使用到 select distinct object name id from syscomments where id in select object id from sys.objects where type p and text like ta...

儲存過程系列之儲存過程sql查詢儲存過程的使用

1.查詢某個表被哪些儲存過程 以下簡稱 sp 使用到 select distinct object name id from syscomments where id in select object id from sys.objects where type p and text like ta...