Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to convert table function to a table

3603936Dec 18 2017 — edited Dec 18 2017

I am suspecting this table function might be somehow adding special characters. I need to output this data to a table to analyze.  How can we do this pls?  is there a short method without having to create 43 variables to hold the 43 columns?

    FUNCTION cast_property_table(i_PropertyTable IN tt_property_update) RETURN SYS_REFCURSOR IS

        l_Property SYS_REFCURSOR;

        TYPE y is table of varchar2(4000) index by pls_integer;

        t y;

    BEGIN

        --Return the object table as a ref cursor

        OPEN l_Property FOR

            SELECT PropertyKey

                  ,PropName

                  ,PageDescr

                  ,parentPropertykey

                  ,parentPropertyval

                  ,parentDataAliasID

                  ,VirtualColName

                  ,DomainKey

                  ,DomainFilterValue

                  ,DataType

                  ,DataSubType

                  ,ReqdFlg

                  ,DfltValue

                  ,UserReadFlg

                  ,UserWriteFlg

                  ,MinSize

                  ,MaxSize

                  ,MaxOccurs

                  ,EditMask

                  ,MINVALUE

                  ,MAXVALUE

                  ,PropEffectFlg

                  ,DateStart

                  ,DateEnd

                  ,decode(row_id

                         ,NULL

                         ,nvl(BaseValue

                             ,DfltValue)

                         ,BaseValue) BaseValue

                  ,PropClob

                  ,decode(row_id

                         ,NULL

                         ,nvl(FinalValue

                             ,DfltValue)

                         ,FinalValue) FinalValue

                  ,Row_id

                  ,RowVersion

                  ,hyperClientObjectID

                  ,hyperURL

                  ,hyperPropertyKey

                  ,hyperpskey

                  ,dfltfiltervalue

                  ,seq

                  ,viewrowversion

                  ,primarydisplayflg

                  ,dfltFilterType

                  ,dfltFilterOperator

                  ,UiDisplayMethod

                  ,DfltValueDStart

                  ,'N' PrimaryKey

            FROM   TABLE(CAST(i_PropertyTable AS tt_property_update)) prop

            WHERE  prop.primarydisplayflg = 'Y'

            ORDER  BY prop.seq;

         

         -- I want to do this

         CREATE TABLE table1 AS SELECT * FROM tablefunction OR SYSREFCURSOR;

        

         

        RETURN l_Property;

    EXCEPTION

        WHEN OTHERS THEN

            RAISE;

    END cast_property_table;

This post has been answered by BEDE on Dec 18 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 15 2018
Added on Dec 18 2017
6 comments
608 views