--行转列的函数-- CREATE OR REPLACE FUNCTION Calvin( col IN VARCHAR2,dw IN VARCHAR2) RETURN VARCHAR2 IS retval varchar2(32); Sel_sql varchar2(2000); ---//SQL语句声明 BEGIN Sel_sql:=‘select ‘||col||‘ from TB5001 where dwdm=‘‘‘|| dw||‘‘‘‘; execute immediate Sel_sql into retval ;--执行oracle 方法 RETURN lower(retval); END; / select calvin(zdm,‘ftgm‘) as key,wbklx from JGTB5001;
时间: 2024-10-05 20:24:39