日期:2014-05-16  浏览次数:20460 次

oracle存储过程1
CREATE OR REPLACE FUNCTION F_OBTAIN_FTP_ATTRVALUE (apsi_record_id IN VARCHAR2)
   RETURN VARCHAR2
IS
   attributevalue   VARCHAR2 (4000);

   CURSOR cur
   IS
      SELECT attribute_value
        FROM t_apsi_prod_attr_record
       WHERE apsi_prod_record_id = apsi_record_id
         AND attribute_value IS NOT NULL;
BEGIN
   attributevalue := ' ';

   FOR c IN cur
   LOOP
      --if(attributevalue='') then
      -- dbms_output.put_line('none^^');
      -- end if;

      --dbms_output.put_line('begin^^'||attributevalue);

      -- dbms_output.put_line('c.ATTRIBUTE_VALUE'||c.ATTRIBUTE_VALUE);
      IF (attributevalue = ' ')
      THEN
         attributevalue := c.attribute_value;
         DBMS_OUTPUT.put_line ('begin attributevalue^^' || attributevalue);
      ELSE
         attributevalue := attributevalue || '|' || c.attribute_value;
         DBMS_OUTPUT.put_line ('end attributevalue^^' || attributevalue);
      END IF;
   END LOOP;

   RETURN attributevalue;
END;

我的异常网推荐解决方案:oracle存储过程,http://www.aiyiweb.com/oracle-develop/177537.html