Home » SQL & PL/SQL » SQL & PL/SQL » ORA-02315: incorrect number of arguments for default constructor (Oracle 12.2)
ORA-02315: incorrect number of arguments for default constructor [message #682624] Tue, 03 November 2020 10:10 Go to next message
TroyHoopes
Messages: 2
Registered: November 2020
Junior Member
How do I "look into" elements of my object?

I have an object table created with the following:

CREATE OR REPLACE TYPE ACT.tcs_acct_rec FORCE AS OBJECT
( client_id NUMBER(10),
can VARCHAR2(34 BYTE),
year NUMBER(4),
taxdtl_rec tcs_taxdtl, -- record object
valdtl_rec tcs_valdtl, -- record object
owner_rec tcs_owner, -- record object
apports_tab tcs_apports, -- table of record objects
receivables_tab tcs_receivables, -- table of record objects
specexems_tab tcs_specexems, -- table of record objects
notes_tab tcs_notes_tab); -- table of record objects
/
CREATE OR REPLACE TYPE ACT.tcs_acct_rec_tab FORCE AS TABLE OF tcs_acct_rec;

I wrote a function that is populating the data in this structure, I can see it in SQL*Plus, just not very clean to look at. I wrote the following query which returns the data:
SELECT CAST(MULTISET(
SELECT * FROM TABLE(trh_test_work(98000000, '100007', 2020))
WHERE client_id = 98000000
AND can = '100007'
AND year = 2005) AS tcs_acct_rec_tab)
FROM DUAL;

This second query does not let me look at the data I want to access in the given record. How do I properly reference to avoid the ORA-02315?
SELECT CAST(MULTISET(
SELECT client_id, can, year, owner_rec FROM TABLE(trh_test_work(98000000, '100007', 2020))
WHERE client_id = 98000000
AND can = '100007'
AND year = 2005) AS tcs_acct_rec_tab)
FROM DUAL;
Re: ORA-02315: incorrect number of arguments for default constructor [message #682627 is a reply to message #682624] Tue, 03 November 2020 11:58 Go to previous messageGo to next message
Michel Cadot
Messages: 67923
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Welcome to the forum.
Please read the OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Indent the code, use code tags and align the columns in result.

With any SQL or PL/SQL question, please, Post a working Test case: create statements for all objects and insert statements along with the result you want with these data then we will be able work with your table and data. Explain with words and sentences the rules that lead to this result.

Re: ORA-02315: incorrect number of arguments for default constructor [message #682628 is a reply to message #682627] Tue, 03 November 2020 12:28 Go to previous messageGo to next message
TroyHoopes
Messages: 2
Registered: November 2020
Junior Member
Thanks for the response. The details of this are too large, and some is confidential to post according to the requirements for your help. I was hoping someone could see the problem in my SELECT statement from what I provided, but guess not. Thank you anyway.
Re: ORA-02315: incorrect number of arguments for default constructor [message #682629 is a reply to message #682628] Tue, 03 November 2020 12:49 Go to previous message
Michel Cadot
Messages: 67923
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

You already posted a type, why not the others? I don't what can be confidential, you can provide only (i.e. modify the types) what is necessary for your question. You can simulate your issue with a simple test case (which is the best way better than the actual types with dozen of columns or types that are not related to the issue, simplify it, note we don't need your account name in the statements like the one you posted).

All necessary types as mandatory for us to test what we may provide you. We can't be sure of our "solution" if we can't test it and it won't give anything and just waste everyone time we provide invalid statements.

Previous Topic: SQL query
Next Topic: How to subtract dates between different rows
Goto Forum:
  


Current Time: Sat Jul 31 14:08:21 CDT 2021