?
Solved

rowtype pl/sql function in a view

Posted on 2011-02-16
6
Medium Priority
?
753 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
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.
Suggested Courses

752 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