CREATE OR REPLACE PROCEDURE P_Pub_GetList ( StrWhere varchar2, ---查询条件(不带where关键字的查询条件) TableName varchar2, ---表名称 Field varchar2, ---字段名称 curArg out sys_refcursor --返回记录集 ) IS v_sql long := ‘‘; --sql语句 begin if StrWhere = ‘[email protected]#$%^&*()全部‘ then--获取所有 v_sql := ‘select ‘|| Field ||‘ from ‘ || TableName; else --获取符合条件的 if StrWhere is not null then v_sql := ‘select ‘|| Field ||‘ from ‘ || TableName || ‘ where ‘ || StrWhere; else v_sql := ‘select ‘|| Field ||‘ from ‘ || TableName; end if; end if; --DBMS_OUTPUT.put_line(v_sql); OPEN curArg FOR v_sql; end P_Pub_GetList;
时间: 2024-10-17 02:06:04