Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 182
  • Last Modified:

sql view

HI, does anyone know that can I call a function to return a value back in a view?
0
ship123
Asked:
ship123
  • 2
  • 2
2 Solutions
 
slightwv (䄆 Netminder) Commented:
Yes if I understand the question,  just select from dual:
Create view my_view as select function_name() from dual;
0
 
sdstuberCommented:
create view my_view as
select my_column, my_function(my_column) as function_result from my_table
0
 
slightwv (䄆 Netminder) Commented:
You need to alias the function.
0
 
sdstuberCommented:
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
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now