[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

rowtype pl/sql function in a view

Posted on 2011-02-16
6
Medium Priority
?
755 Views
Last Modified: 2013-12-19
I am trying to use a function I have built inside a view and I want to pass the whoel row into the function.

create or replace view Mac_Commis_Rev_Dtl_ial as
select
 x.cest_customer_no
,JA_TEST.Commission_Zip   (u.* ,x.* ) Zip_code
from mac_commission_revenue_tab x
,mac_commission_product_group u
where u.product_group_code = x.cest_product_group_code
WITH   read only;

my function works inside a normal pl/sql block, but I want to generaically pass the row to the function. This will help me with maintanence.

I dont want to list out each column name from the table, just want to pass the row

Currently I get a ORA-01747 error
0
Comment
Question by:jhacharya
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 28

Assisted Solution

by:Naveen Kumar
Naveen Kumar earned 1000 total points
ID: 34914900
I don't think there is a direct way out to do that.

0
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 34914913
but i think it can work if you have created a type as a database object and used this type in your table and you have created the function to receive this type object and then internally in your function code you can access each member ( basically each column ) of this type object accordingly.

0
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 34914925
using * to refer to all the fields may be simple and help at some times but beware of the other side as well like ( what happens to your function if one existing column is dropped from the table or a new column is added to the table or some column is renamed to some other name i,e your function has to be written in a generic fashion to take care of all these cases )
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 34914945
" my function works inside a normal pl/sql block " --> what does this mean ? Can you give sample code here to understand this.
0
 
LVL 74

Accepted Solution

by:
sdstuber earned 1000 total points
ID: 34915405
You can't pass a rowtype in sql.

if you use object type, you'll need to pass invoke a constructor to assemble the type from the columns.

I recommend overloading your function,  keep the version you have that accepts a rowtype variable.

but create another one that accepts every column and then simply invokes the other one.
0
 
LVL 2

Author Closing Comment

by:jhacharya
ID: 34916790
it cant be done !!!!! oh well hope oracle an come up with an improvement in their SQL to handle this ...
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.

649 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