sql view

Posted on 2011-10-24
Last Modified: 2013-01-21
HI, does anyone know that can I call a function to return a value back in a view?
Question by:ship123
    LVL 76

    Assisted Solution

    by:slightwv (䄆 Netminder)
    Yes if I understand the question,  just select from dual:
    Create view my_view as select function_name() from dual;
    LVL 73

    Accepted Solution

    create view my_view as
    select my_column, my_function(my_column) as function_result from my_table
    LVL 76

    Expert Comment

    by:slightwv (䄆 Netminder)
    You need to alias the function.
    LVL 73

    Expert Comment

    if you're trying to pass a parameter to a function that will be called via the view  - you can't
    at least not directly.

    instead,  you'll do it in two steps.

    first,  set a package variable that the function can reference
    or create a system context
    or populate a table or other datasource the function can use.

    then query the view

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
    Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
    This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
    This video shows how to recover a database from a user managed backup

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now