SYSTEMWIDE TABLE TYPE
To pass data back to the calling program, the function module needs an export
parameter with the type of an internal table. For this, we define a systemwide
table type INTERNAL-TABLE-NAME with the line type DATABASE-TABLE in the ABAP Dictionary.
where can i create the INTERNAL-TABLE-NAME ????
Hi Rajesh,
its associated type will be same as DATABASE-TABLE in the ABAP Dictionary.
Regards,
Atish
Similar Messages
-
How to populate internal table( varaible of ABAP table type) in Excel VBA?
Hi,
I am trying to update a database table from excel using a VBA Macro.
I am able to connect to SAP and able to read data from SAP using a RFC. Similarly after updating certain values, i want to update a table in SAP.
Below are the steps I am doing apart from basic settings.
Getting the reference of the SAP TABLE type from RFC fucntion module
' Call RFC
Set MyFunc = R3.Add("UPDATE_TVARVC_VIA_RFC")
' Get reference and Values TVARVC
Set oParam4 = MyFunc.Tables("TVARVC")
2. Loop over the active cells and populate oParam4
" add values as below
oParam4.Rows.Add
oParam4.Value(1, "NAME") = ..................
oParam4.Value(1, "TYPE") = ..................
oParam4.Value(1, "NUMB") = ..................
Do it for all columns in the table line.
My query is how to identify active cells and make the above code dynamic in step 2.
Thanks in Advance,
Best,
AneelHi Aneel,
You can try the following:
e.g.
for j = 1 to ActiveCell.SpecialCells(11).Column
oParam4.Rows.Add
if j=1 then oParam4.Value(j, "NAME") = ActiveSheet.Cells(1,j).Value
if j=2 then oParam4.Value(j, "TYPE") = ActiveSheet.Cells(1,j).Value
if j=3 then oParam4.Value(j, "NUMB") = ActiveSheet.Cells(1,j).Value
next j
Regards,
ScriptMan -
I am facing a strange SQL exception:-
The code flow is like this:
.Net 4.0 --> Entity Framework --> SQL 2008 ( StoredProc --> Function {Exception})
In the SQL Table-Valued Function, I am selecting a column (nvarchar(50)) from an existing table and (after some filtration using inner joins and where clauses) inserting the values in a Table Type Object having a column (nvarchar(50))
This flow was working fine in SQL 2008 but now all of sudden the Insert into @TableType is throwing "string or binary data would be truncated" exception.
Insert Into @ObjTableType
Select * From dbo.Table
The max length of data in the source column is 24 but even then the insert statement into nvarchar temp column is failing.
Moreover, the same issue started coming up few weeks back and I was unable to find the root cause, but back then it started working properly after few hours
(issue reported at 10 AM EST and was automatically resolved post 8 PM EST). No refresh activity was performed on the database.
This time however the issue is still coming up (even after 2 days) but is not coming up in every scenario. The data set, for which the error is thrown, is valid and every value in the function is fetched from existing tables.
Due to its sporadic nature, I am unable to recreate it now :( , but still unable to determine why it started coming up or how can i prevent such things to happen again.
It is difficult to even explain the weirdness of this bug but any help or guidance in finding the root cause will be very helpful.
I also Tried by using nvarchar(max) in the table type object but it didn't work.
Here is a code similar to the function which I am using:
BEGIN
TRAN
DECLARE @PID
int = 483
DECLARE @retExcludables
TABLE
PID
int NOT
NULL,
ENumber
nvarchar(50)
NOT NULL,
CNumber
nvarchar(50)
NOT NULL,
AId
uniqueidentifier NOT
NULL
declare @PSCount int;
select @PSCount =
count('x')
from tblProjSur ps
where ps.PID
= @PID;
if (@PSCount = 0)
begin
return;
end;
declare @ExcludableTempValue table (
PID
int,
ENumber
nvarchar(max),
CNumber
nvarchar(max),
AId
uniqueidentifier,
SIds
int,
SCSymb
nvarchar(10),
SurCSymb
nvarchar(10)
with SurCSymbs as (
select ps.PID,
ps.SIds,
csl.CSymb
from tblProjSur ps
right
outer join tblProjSurCSymb pscs
on pscs.tblProjSurId
= ps.tblProjSurId
inner join CSymbLookup csl
on csl.CSymbId
= pscs.CSymbId
where ps.PID
= @PID
AssignedValues
as (
select psr.PID,
psr.ENumber,
psr.CNumber,
psmd.MetaDataValue
as ClaimSymbol,
psau.UserId
as AId,
psus.SIds
from PSRow psr
inner join PSMetadata psmd
on psmd.PSRowId
= psr.SampleRowId
inner join MetaDataLookup mdl
on mdl.MetaDataId
= psmd.MetaDataId
inner join PSAUser psau
on psau.PSRowId
= psr.SampleRowId
inner
join PSUserSur psus
on psus.SampleAssignedUserId
= psau.ProjectSampleUserId
where psr.PID
= @PID
and mdl.MetaDataCommonName
= 'CorrectValue'
and psus.SIds
in (select
distinct SIds from SurCSymbs)
FullDetails
as (
select asurv.PID,
Convert(NVarchar(50),asurv.ENumber)
as ENumber,
Convert(NVarchar(50),asurv.CNumber)
as CNumber,
asurv.AId,
asurv.SIds,
asurv.CSymb
as SCSymb,
scs.CSymb
as SurCSymb
from AssignedValues asurv
left outer
join SurCSymbs scs
on scs.PID
= asurv.PID
and scs.SIds
= asurv.SIds
and scs.CSymb
= asurv.CSymb
--Error is thrown at this statement
insert into @ExcludableTempValue
select *
from FullDetails;
with SurHavingSym as (
select distinct est.PID,
est.ENumber,
est.CNumber,
est.AId
from @ExcludableTempValue est
where est.SurCSymb
is not
null
delete @ExcludableTempValue
from @ExcludableTempValue est
inner join SurHavingSym shs
on shs.PID
= est.PID
and shs.ENumber
= est.ENumber
and shs.CNumber
= est.CNumber
and shs.AId
= est.AId;
insert @retExcludables(PID, ENumber, CNumber, AId)
select distinct est.PID,
Convert(nvarchar(50),est.ENumber)
ENumber,
Convert(nvarchar(50),est.CNumber)
CNumber,
est.AId
from @ExcludableTempValue est
RETURN
ROLLBACK
TRAN
I have tried by converting the columns and also validated the input data set for any white spaces or special characters.
For the same input data, it was working fine till yesterday but suddenly it started throwing the exception.Remember, the CTE isn't executing the SQL exactly in the order you read it as a human (don't get too picky about that statement, it's at least partly true enough to say it's partly true), nor are the line numbers or error messages easy to read: a mismatch
in any of the joins along the way leading up to your insert could be the cause too. I would suggest posting the table definition/DDL for:
- PSMetadata, in particular PSRowID, but just post it all
- tblProjectSur, in particularcolumns CSymbID and TblProjSurSurID
- cSymbLookup, in particular column CSymbID
- PSRow, in particular columns SampleRowID, PID,
- PSAuser and PSUserSur, in particualr all the USERID and RowID columns
- SurCSymbs, in particular colum SIDs
Also, a diagnostic query along these lines, repeat for each of your tables, each of the columns used in joins leading up to your insert:
Select count(asurv.sid) as count all
, count(case when asurv.sid between 0 and 9999999999 then 1 else null end) as ctIsaNumber
from SurvCsymb
The sporadic nature would imply that the optimizer usually chooses one path to the data, but sometimes others, and the fact that it occurs during the insert could be irrelevant, any of the preceding joins could be the cause, not the data targeted to be inserted. -
Dont work 'REUSE_ALV_FIELDCATALOG_MERGE' with table type
Hi Experts ;
My problem about 'REUSE_ALV_FIELDCATALOG_MERGE' .
I use intarnal table with Table Type ( with header line ). And 'REUSE_ALV_FIELDCATALOG_MERGE' is not working . Field catalog is employ. I dont use 'REUSE_ALV_FIELDCATALOG_MERGE' have any problem.'REUSE_ALV_FIELDCATALOG_MERGE' expects a flat structure.
Give the reference of the line type of the table type if you wish to have fieldcatalog as per that..
Even if you dont use 'REUSE_ALV_FIELDCATALOG_MERGE' you can create your own Fieldcatalog.. -
How to retrieve the values from PL/SQL table types.
Hi Every one,
I have the following procedure:
DECLARE
TYPE t1 IS TABLE OF emp%ROWTYPE
INDEX BY BINARY_INTEGER;
t t1;
BEGIN
SELECT *
BULK COLLECT INTO t
FROM emp;
END;
This procedure works perfectly fine to store the rows of employee in a table type. I am not able to retrieve the values from Pl/SQL table and display it using dbms_output.put_line command.
Can anybody help me please!!!!!
Thanks
Ahmed.You mean, you can't add this
for i in t.first..t.last loop
dbms_output.put_line(t(i).empno||' '||t(i).ename||' '||t(i).job);
end loop;or you can't add this
set serveroutput onor maybe, you are working in third party application where dbms_output is not applicable at all?
You see, not able like very similar it is not working - both are too vague...
Best regards
Maxim -
Passing parameters to PL/SQL table types
Hi Everybody,
I have one question about passing PL/SQL tables types and tabs as IN parameter in procedure.I am working in 11.2.0.2.0 environment. I am stuck on how to pass those values to procedure.Please find below more details:
Table 1:
CREATE TABLE ITEMS
ITEM_ID VARCHAR2(40 BYTE) NOT NULL,
ITEM_NAME VARCHAR2(40 BYTE),
SERIAL NUMBER(2),
ADDED_ON DATE);
Table 2:
CREATE TABLE ITEM_ACTIVITY_INFO
ITEM_ID VARCHAR2(40 BYTE) NOT NULL,
ACCOUNT_TYPE VARCHAR2(1 BYTE),
ID_NUMBER NUMBER(3),
ACTIVATION_DATE DATE);
Table 3:
CREATE TABLE ITEM_GROUP
GROUP_ID NUMBER(2) NOT NULL,
ITEM_ID VARCHAR2(40 BYTE),
GROUP_TYPE VARCHAR2(20 BYTE),
GROUP_DATE DATE);
Table 4:
CREATE TABLE ITEM_ADDRESS
GROUP_ID NUMBER(2) NOT NULL,
NAME VARCHAR2(60 BYTE),
ADDRESS VARCHAR2(100));
Following types are created:
CREATE OR REPLACE TYPE ITEMS_TYPE AS OBJECT
ITEM_ID VARCHAR2(40 BYTE),
ITEM_NAME VARCHAR2(40 BYTE),
SERIAL NUMBER(2),
ADDED_ON DATE);
CREATE OR REPLACE TYPE ITEM_ACTIVITY_TYPE AS OBJECT
ITEM_ID VARCHAR2(40 BYTE),
ACCOUNT_TYPE VARCHAR2(1 BYTE),
ID_NUMBER NUMBER(3),
ACTIVATION_DATE DATE);
CREATE OR REPLACE TYPE ITEM_GROUP_COMP_TYPE AS OBJECT
GROUP_ID NUMBER(2) NOT NULL,
ITEM_ID VARCHAR2(40 BYTE),
GROUP_TYPE VARCHAR2(20 BYTE),
GROUP_DATE DATE
ITEM_ADDRESS_IN ITEM_ADDRESS_TYPE);
CREATE OR REPLACE TYPE ITEM_ADDRESS_TYPE AS OBJECT
GROUP_ID NUMBER(2),
NAME VARCHAR2(60 BYTE),
ADDRESS VARCHAR2(100));
CREATE OR REPLACE TYPE ITEM_GROUP_COMP_TAB AS TABLE OF ITEM_GROUP_COMP_TYPE;
Create or replace procedure ITEM_ADD_CHANGE(
ITEM_IN IN ITEMS_TYPE,
ITEM_ACTIVITY_IN IN ITEM_ACTIVITY_TYPE,
ITEM_GROUP_IN IN ITEM_GROUP_COMP_TAB,
ITEM_OUT IN OUT ITEMS.ITEM_ID%TYPE);
Above are the paramteres we are passing to procedure.
I need help in how to pass parameters to above procedure. All comments and responses will be highly appreciated. Thanks everyone for going through the post. Please let me know if more more information is required on this problem.
Regards
DevBilly Verreynne wrote:
Types used in this fashion, only make sense if the table is based on the type. It makes very little sense to have a table structure and then to duplicate the structure using a type.
The 2 structures may be defined the same. But they are NOT interchangeable and requires one to be converted to the other to use. This is not sensible in my view. It is far easier in that case to simply use the PL/SQL macro +%RowType+ to create a duplicate structure definition - one that can natively be used for touching that table, without conversions required.
If you do want to use types, define the type, then define the table of that type, adding the required constraints (pk, fk, not null, check) to the table's definition.Billy:
Just curious, why do you say it makes very little sense to have a type modeled on a table? I do that a lot. In my case, I am getting the values from an external program, not building them manually, but it makes a lot of sense to me.
One application where I do this a lot has a java front-end that parses HL7 messages. Each message contains at least minimal information about a variable number of entities (and often several rows for an entity) in the database, and must be processed as a single atomic trasnaction. So, rather than have potentially hundreds of parameters to the "main" driver procedures for different message types I created a set of types more or less identical to the tables representing the entities. The java program parses the mesasge and populates the type, then calls the appropriate stored procedure for the message type passing in the populated types. My stored procedure then does inserts/updates or deletes as appropriate over potentially dozens of tables.
John -
Page break handeling when using table type field
Hello everyone
I've created an adobe form using tcode SFP.
A table, "T1", is containing fields where one of it is a TABLE TYPE (Let give the following name "T1-FT1").
So the structure can look like:
T1-F1
T1-F2
T1-FT1-FTF1
T1-FT1-FTF2
basically the structure is like to have documents containing several items where those items have several serial number.
I need to have page break per documents, per items and serial number where those one have specific header page different than the document itself.
I need to have a page break per T1 records with specifc header.
So for each new records of T1, I have to create a new page with it's specific header.
The table T1-FT1 is starting on the current page, but if I have to many records to stay on the page I need to create another page with it's specific header that is different than the page 1.
My problem is the page break handling.
I can have the pagination tab at the Table1 and row1 level but I don't have the pagination tab at the T1-FT1 level.
Here is what my hierarchy:
_MasterPage
__Page1
__Page2
_MainSubForm
__Subform1
___Table1
____Row1
_____Subform
______Table2
________Row2
Example of Data:
T1-F1 ___ T1-F2 __ T1-FT1-FTF1 __ T1-FT1_FTF2
A _______ B _____ 1 ___________ 1
A _______ B _____ 1 ___________ 2
B _______ C _____ 1 ___________ 1
B _______ D _____ 1 ___________ 2
B _______ D _____ 1 ___________ 3
The final page break layout should look like:
Page1
Header1
A B
___ 1 1
___ 1 2
Page2
Header1
B C
___ 1 1
___ 1 2
Page 3
Header2
B C
___ 1 3
Because there is not enough room on page 2 for the last record of the table T1-FT1, a new header is used on page 3.
Actually several problems occurs. I cannot have the proper page break set to avoid empty pages as first or last page.
The pagination tab stop to be available after the Row1. So we cannot set page break at the table2 and row2.
The page break contidion doesn't work. "Well I didn't succeed to make it work".
Any idea on how to handle those page break at table2 level?
Is anyone had to create a PDF form where we have the date into several level of structure?
Regards
dstj
Edited by: dstj on Feb 18, 2010 10:59 PM
Edited by: dstj on Feb 18, 2010 11:00 PMI have the exact same issue. Could not find a solution. In my case, there are multiple subforms printed one below the other. If an expandable subform overflows into a new page, the last line overlaps with the text of next subform. I have added blank spaces between the subforms but, that does not solve the issue.
Finally, I have managed to minimize the occurrence of the issue by doing the following. Only turn on the flag "Allow Page breaks within content" for subforms that can really spread over many pages. All other subforms, turn the flag off. This minimizes the possibility of overlapping. -
How to use Oracle Table Type values in Select Statement.
Hi,
I am fetching initial set of values into Oracle Table of Records Type and want to use list of values in the Select statement.
For example, try something like the following:
TYPE t_record IS RECORD (
ID TABLEA.ID%type,
NO TABLEA.NO%type,
v_record t_record;
TYPE t_table IS TABLE OF v_record%TYPE;
v_table t_table;
-- Code to populate the values in v_table here.
SELEC ID,NO, BULK COLLECT INTO <some other table variabes here> FROM TABLEA
WHERE ID IN v_table(i).ID;
I want to know how to use the values from Oracle Table Type in the Select Statement.Something like this:
create or replace type t_record as object (
id number,
no number
CREATE or replace type t_table AS TABLE OF t_record;
set serveroutput on
declare
v_table t_table := t_table();
v_t1 t_table := t_table();
begin
v_table.extend(1);
v_table(1).ID := 1;
v_table(1).No := 10;
v_table.extend(1);
v_table(2).ID := 2;
v_table(2).ID := 20;
SELEC t_record (ID,NO) BULK COLLECT INTO v_t1
from TableA
FROM TABLEA
WHERE ID IN (select t.ID from table(v_Table) t);
for i in 1..v_t1.count loop
dbms_output.put_line(v_t1(i).ID);
dbms_output.put_line(v_t1(i).No);
end loop;
end;
/Untested!
P;
Edited by: bluefrog on Mar 5, 2010 5:08 PM -
Error while doing Bulk Collect to a table type
I'm using a Table type to accumulate resultset from a loop and finally return the records in the table type as a ref cursor to the front end.
But when I'm using Bult collect to insert into the table type object it keeps throwing an error
'PLS-00597: expression 'TAB_CALENDAR_AVAIL_RESULTSET' in the INTO list is of wrong type'. Can someone help me to let me know what could be the reason for this error. I'm not able to proceed further, please help.
Here is the code.
CREATE OR REPLACE PACKAGE hotel
AS
TYPE calendar_cursor IS REF CURSOR;
TYPE type_calendar_avail is RECORD(
HOTEL_ID AVAILABILITY_CALENDAR.hotel_id%TYPE,--varchar2(4), --AVAILABILITY_CALENDAR.hotel_id%TYPE,
AVAIL_DATE AVAILABILITY_CALENDAR.AVAIL_DATE%TYPE ,
TOTAL_COUNT number
TYPE type_calendar_avail_resultset IS TABLE OF type_calendar_avail;
tab_calendar_avail_resultset type_calendar_avail_resultset ; -- declare variable of type type_calendar_avail_resultset
PROCEDURE sp_get_calendar_results (
sallhotelswithavaildate VARCHAR2,
ilengthofstay NUMBER,
sorcowner VARCHAR2,
all_unittypes VARCHAR2, --DBMS_SQL.VARCHAR2S
calendar_resultset OUT calendar_cursor
-- tab_calendar_avail_resultset out type_calendar_avail_resultset
PROCEDURE sp_get_calendar_results (
sallhotelswithavaildate VARCHAR2,
ilengthofstay NUMBER,
-- ivariant NUMBER,
sorcowner VARCHAR2,
all_unittypes VARCHAR2, --DBMS_SQL.VARCHAR2S
calendar_resultset OUT calendar_cursor
AS
sbuf VARCHAR2 (200);
sepr VARCHAR2 (1);
shotelwithdate VARCHAR2 (200);
shotelid VARCHAR2 (10);
savaildate VARCHAR2 (8);
sactualavaildate VARCHAR2 (8);
pos NUMBER;
istart NUMBER;
sstartdate VARCHAR2 (8);
senddate VARCHAR2 (8);
squery VARCHAR2 (32767) := '';
sunittypecond VARCHAR2 (500) := '';
sunitdesccond VARCHAR2 (500) := '';
v_unit_cond a_unit_cond;
tempunitcond VARCHAR2 (50) := '';
BEGIN
istart := 1;
LOOP
tempunitcond := hotel.stringtokenizer (all_unittypes, istart, '|');
IF tempunitcond IS NOT NULL
THEN
v_unit_cond (istart) := tempunitcond;
istart := istart + 1;
END IF;
EXIT WHEN tempunitcond IS NULL;
END LOOP;
sunitdesccond := hotel.get_unit_description_cond (v_unit_cond);
DBMS_OUTPUT.put_line ('unit description : ' || sunitdesccond);
sbuf := sallhotelswithavaildate;
sepr := '|';
istart := 1;
LOOP
shotelwithdate := hotel.stringtokenizer (sbuf, istart, sepr);
EXIT WHEN shotelwithdate IS NULL;
shotelid :=
SUBSTR (shotelwithdate, 1, INSTR (shotelwithdate, ',') - 1);
savaildate :=
SUBSTR (shotelwithdate, INSTR (shotelwithdate, ',') + 1);
squery :=
' SELECT MIN (ad.avail_date) '
|| ' FROM wvo_fonres.fpavail_daily ad'
|| ' WHERE ad.hotel_id = '
|| shotelid
|| ' AND ad.days_left >= '
|| ilengthofstay
|| ' AND ad.avail_date >= '
|| savaildate;
IF UPPER (sorcowner) = 'N'
THEN
squery :=
squery
|| ' AND ad.ORC_TYPE != ''R'' and ad.ORC_TYPE != ''P'' and ad.ORC_TYPE != ''E'' ';
END IF;
squery := squery || ' AND ( ' || sunitdesccond || ') ';
EXECUTE IMMEDIATE squery
INTO sactualavaildate;
DBMS_OUTPUT.put_line ('Actual available Date: ' || sactualavaildate);
hotel.sp_get_startdate_enddate (sactualavaildate,
--ivariant,
sstartdate,
senddate
sunittypecond := hotel.get_unittype_cond (v_unit_cond, sorcowner);
-- execute immediate
squery :=
'select HOTEL_ID, AVAIL_DATE, ' || sunittypecond || ' AS TOTAL_COUNT '
|| ' FROM AVAILABILITY_CALENDAR A '
|| 'WHERE '
|| 'AVAIL_DATE >= '''
|| sstartdate
|| ''' '
|| 'AND '
|| 'AVAIL_DATE <= '''
|| senddate
|| ''' '
||'AND '
|| 'A.HOTEL_ID IN ('
|| shotelid
|| ') '
|| 'AND ('
|| sunittypecond
|| '> 0) '
|| -- where total available count of unit type is greater than 0
' ORDER BY AVAIL_DATE'; --order clause
open calendar_resultset for squery;
fetch calendar_resultset BULK COLLECT INTO tab_calendar_avail_resultset;
istart := istart + 1;
END LOOP;
COMMIT;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line
(SQLERRM (SQLCODE));
RAISE;
END sp_get_calendar_results;
END hotel;
/1. put tags [co[/b][b]de] and [co[/b][b]de] around your code, so it's readable
B. what does "hotel.get_unittype_cond (v_unit_cond, sorcowner)" actually retun?
and third, try this for the array declaration:
tab_calendar_avail_resultset type_calendar_avail_resultset := type_calendar_avail_resultset ; () ; -
Assigning data from one Table type to another structure
Hi every one,
I have a table type X sent from one function module to another Proxy generated method which has the parameter defined as a structure.
I have declared a variable Y as a LINE TYPE OF X.
Then I have this statement which fills up the data.
READ TABLE X INTO Y INDEX 1.
The data is transferred from X to Y.
Now i need to send this to the proxy generated Function module which has a structure Z.
Now when i say MOVE-CORRESPONDING Y to a variable of type Z, it says it cannot be converted.
The structure in proxy generated FM has different data type but the same domain as that of standard one.
Everywhere it is prefixed with YY.
And also has one additional Controller tab inserted,
Can you guys tell me how to move the data from this table type to the structure.
- VenkatHi,
Declare a variable of line type Z.
Move corresponding values from variable X to this variable.
Append this variable to the table Z.
Try this.
Regards,
R.Nagarajan. -
Issue while writing a query in table type select.in the physical layer
Hi gurus,
I am actually trying to create a table using select in the physical layer..... i acutally am not aware what it is called but its when i click a table in the physical layer i have an option table type and i chose select which allows me type my query..the query is
Select
coln name(which is a lengthly list of conversion) AS column_name
From Table name.
when i view the data rom the physical layer everthing seems to be fine. but when i try to view the data in the frnt end it gives me an error maximum length is too long than 128....
i am aware of this issue the sql server allows only column of length 128..but none of my column length is greater than 128..
Could you please help me in this
Many thanks in advancehi veeravalli ,
Thanks for the reply....actually the corresponding reports for this have already been prepared...i created a view in the backend with the same select which i wrote before and and tried calling the view from her.. i have viewed the data and all is perfect...but when i try viewing it from the front end it error saying invaild object name select * from databasename.dbo.View_name...but i have checked the view exists in the backend...
Thanks in advance.... -
Block with more than one table type agurment - Update Procedure for Block
Hi,
I have one form with 3 Block. First Block is single row block, and other 2 are details block . The details balocks are based on the Procedure datasource, because of the complex query conditions. Now my requirement is When Inserting / Updating the Master Block (Single Row Block), I need to get the values in the two details block , because I need to update some other tables also based on these values. I created a procedure with two Table Type parameters (for each details block) , but when I using this procedure as the Update Procedure Name in the block, I am getting the error Only One table type arguement is allowed. Is there any other method to implement this.
Thanks in advance.Rizly,
A quick summary to make sure I understand your requirements. You have a single row base table master block with two detail blocks that are based on Procedures. When you update the single row base table master block, you need all of the data in the two procedure based detail blocks as there are updates that you have to perform to other tables that use this data. You have created a stored procedure that take two PL/SQL tables as parameters, but you are getting the error that only 1 table parameter is allowed.
I need to ask you a few questions first. What is your Forms version? The stored procedure you created; are you using this procedure in the "On-Insert, On-Update, On-Delete" triggers or do you call the procedure in one of the Base Table block ("Key-Commit, When-Button-Pressed" or other trigger)? When you modify or add a new Master block record are you adding values to the detail blocks or using values from the previous Master block record?
If you are using your procedure in the On-Insert, On-Update or On-Delete trigger(s), then based on your description, the error you are receiving is correct. The "On-..." triggers are constrained in that their procedures expect only a single PL/SQL table, Table of Records or Ref Cursor as a parameter. This is a Forms constraint - not a PL/SQL constraint as Forms is expecting you to only perform actions on the block where the "On-..." Trigger is located.
Perhaps you should consider creating a database Package that has two package specification constructs (Ref Cursor, Table of Records, etc) you can populate from Forms and then simply call the package procedure that will use the Ref Cursors to perform the needed update or inserts.
Hope this helps.
Craig...
If mine or someone elses response was helpful, please mark it accordingly -
Error while assigning values to Table type
Hi,
I am trying to insert some values to a Collection type , while doing that I am facing an error ,
" PLS-00306: wrong number or types of arguments in call to
'XXSCP_AVL_CSP_SQR_O_TP' "PFB my collection type declaration and and assignment .
Object type :
TYPE XXSCP_AVL_CSP_SQR_O_TP AS
OBJECT (
PLAN_ID NUMBER,
SR_INSTANCE_ID NUMBER,
INVENTORY_ITEM_ID NUMBER,
BASE_ITEM_ID NUMBER,
ITEM_NAME VARCHAR2(50),
SUPPLIER_ID NUMBER,
SUPPLIER_SITE_ID NUMBER,
NORMAL_BUY_USAGE VARCHAR2(5),
AVAILABLE_QUANTITY NUMBER ,
SPL_PEG_FLAG VARCHAR2(10),
SQR_LINE_ID VARCHAR2(2000),
SQR_NUMBER VARCHAR2(2000),
SQR_MOQ NUMBER,
BPA_PO_LINE_ID NUMBER,
SUGG_BPA_NUMBER VARCHAR2(30),
BPA_BUY_PRICE_BASIS VARCHAR2(10),
BPA_LINE_NUM NUMBER,
BPA_PO_LINE_LOC_ID NUMBER,
BPA_CURRENCY_CODE VARCHAR2(10),
BPA_PRICE NUMBER,
BPA_PO_HEADER_ID NUMBER,
BPA_EXPIRATION_DATE DATE,
BPA_QUANTITY NUMBER,
ORIG_AVAILABLE_QTY NUMBER
Table type :
TYPE XXSCP_AVL_CSP_SQR_C_TP AS TABLE OF XXSCP_AVL_CSP_SQR_O_TP;Declaraion:
l_tab_avl_csp_sqr XXSCP_AVL_CSP_SQR_C_TP := XXSCP_AVL_CSP_SQR_C_TP();Assignment in body :
l_tab_avl_csp_sqr.EXTEND(1);
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT) := XXSCP_AVL_CSP_SQR_O_TP();
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).plan_id := l_tab_planorders (i).l_num_plan_id;
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).sr_instance_id := l_tab_planorders (i).l_num_sr_instance_id;
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).inventory_item_id := l_tab_planorders (i).l_num_inventory_item_id;
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).base_item_id := l_tab_planorders (i).l_num_base_item_id;
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).item_name := l_tab_planorders (i).l_chr_item_name;
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).supplier_id := l_tab_planorders (i).l_num_supplier_id;
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).supplier_site_id := l_tab_planorders (i).l_num_supplier_site_id;
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).available_quantity := l_rec_pegged_list (j).remaining_aval_qty;
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).spl_peg_flag := 'Y';
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).sqr_line_id := l_rec_pegged_list (j).sqr_line_id;
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).sqr_number := l_rec_pegged_list (j).sqr_number;
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).sqr_moq := l_rec_pegged_list (j).sqr_moq;
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_po_line_id := l_rec_pegged_list (j).bpa_po_line_id;
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).sugg_bpa_number := l_rec_pegged_list (j).bpa_number;
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_buy_price_basis := l_rec_pegged_list (j).bpb_type;
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_line_num := l_rec_pegged_list (j).bpa_line_num;
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_po_line_loc_id := l_rec_pegged_list (j).bpa_lloc_id;
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_currency_code := l_rec_pegged_list (j).bpa_curr_code;
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_price := l_rec_pegged_list (j).bpa_price;
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_expiration_date := l_rec_pegged_list (j).bpa_expiration_date ;
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_quantity := l_rec_pegged_list (j).bpa_quantity ;
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).orig_available_qty := l_rec_pegged_list (j).remaining_aval_qty ;Can anyone help in this issue.
Thanks in advance,
Rakesh
Edited by: Venkat Rakesh on Apr 24, 2013 12:18 AMyou need to add an empty-arg user-defined constructor for your type in order to use, "l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT) := XXSCP_AVL_CSP_SQR_O_TP();"
create or replace
TYPE XXSCP_AVL_CSP_SQR_O_TP AS
OBJECT (
PLAN_ID NUMBER,
SR_INSTANCE_ID NUMBER,
INVENTORY_ITEM_ID NUMBER,
BASE_ITEM_ID NUMBER,
ITEM_NAME VARCHAR2(50),
SUPPLIER_ID NUMBER,
SUPPLIER_SITE_ID NUMBER,
NORMAL_BUY_USAGE VARCHAR2(5),
AVAILABLE_QUANTITY NUMBER ,
SPL_PEG_FLAG VARCHAR2(10),
SQR_LINE_ID VARCHAR2(2000),
SQR_NUMBER VARCHAR2(2000),
SQR_MOQ NUMBER,
BPA_PO_LINE_ID NUMBER,
SUGG_BPA_NUMBER VARCHAR2(30),
BPA_BUY_PRICE_BASIS VARCHAR2(10),
BPA_LINE_NUM NUMBER,
BPA_PO_LINE_LOC_ID NUMBER,
BPA_CURRENCY_CODE VARCHAR2(10),
BPA_PRICE NUMBER,
BPA_PO_HEADER_ID NUMBER,
BPA_EXPIRATION_DATE DATE,
BPA_QUANTITY NUMBER,
ORIG_AVAILABLE_QTY NUMBER,
Constructor
constructor function XXSCP_AVL_CSP_SQR_O_TP return self as result
create or replace
TYPE body XXSCP_AVL_CSP_SQR_O_TP AS
Constructor
constructor function XXSCP_AVL_CSP_SQR_O_TP return self as result
is
begin
return;
end;
end; alternatively, assign your attributes as you construct your instance:
l_tab_avl_csp_sqr.EXTEND(1);
l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT) := new XXSCP_AVL_CSP_SQR_O_TP(
l_tab_planorders (i).l_num_plan_id,
l_tab_planorders (i).l_num_sr_instance_id.
l_tab_planorders (i).l_num_inventory_item_id,
l_tab_planorders (i).l_num_base_item_id,
l_tab_planorders (i).l_chr_item_name,
l_tab_planorders (i).l_num_supplier_id,
l_tab_planorders (i).l_num_supplier_site_id,
l_rec_pegged_list (j).remaining_aval_qty,
'Y',
l_rec_pegged_list (j).sqr_line_id,
l_rec_pegged_list (j).sqr_number,
l_rec_pegged_list (j).sqr_moq,
l_rec_pegged_list (j).bpa_po_line_id,
l_rec_pegged_list (j).bpa_number,
l_rec_pegged_list (j).bpb_type,
l_rec_pegged_list (j).bpa_line_num,
l_rec_pegged_list (j).bpa_lloc_id,
l_rec_pegged_list (j).bpa_curr_code,
l_rec_pegged_list (j).bpa_price,
l_rec_pegged_list (j).bpa_expiration_date,
l_rec_pegged_list (j).bpa_quantity,
l_rec_pegged_list (j).remaining_aval_qty );Gerard
Edited by: gaverill on Apr 23, 2013 12:12 PM -
Syntax error when creating a user-defined table type in SQL Server 2012
Why am I getting a syntax error when creating a user-defined table type in SQL Server 2014?
CREATE TYPE ReportsTableType AS TABLE
( reportId INT
, questionId INT
, questionOrder INT );
Results:
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'AS'.Hope these posts could help,
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/37a45a9a-ed8c-4655-be93-f6e6d5ef44be/getting-incorrect-syntax-while-creating-a-table-type-in-sql-server-2008-r2?forum=transactsql
Regards, Dineshkumar,
Please Mark as Answer if my post answers your question and
Vote as Helpful if it helps you -
What is the maximum rows allowed in PLSQL array table type?
Hi,
I have a procedure and it contains the cursor which will fetch more than 500 records. And i have 5 output parameters to store the values coming from the cursor. I don't want to store that into custom table. I want to save it one table type array or something like that. Now i want to know what is the maximum storage of array table type? If i store more than 500 data, how will be the performance? Then is there any other way to achieve this? And that should not decrease the preformace.Let me know your thoughts.
ThanksIt really depends on what you are planning to do with the records once you return them from your stored procedure, and what client is on the receiving end of the results.
One option would be to just return a ref cursor and let the client deal with retreiving the rows themselves, whether one by on or by a bulk collect. Another option would be to declare a table of records matching the result set and do a bulk collect into that table type in your procedure and return the table type to the caller. You could also declare a table type for each field in the resultset, bulk collect the records into thos types and return one for each field.
Personally, I would likely go with returning a ref cursor. Both of the collect the resultset in your procedure and then return collections to the caller methods require memory on the database server to hold the entire resultset and memeory on the client to hold the entire resultset. While 500 records is probably not going to be too bad on memory, if the result set grows, you will run into memory issues at some point.
John
Maybe you are looking for
-
Flash Player Suck It Doesn't Work
I'm SO Pissed off i cant watch any videos what so ever on My Computer everytime i try it says Javascript may be turned off or my Flash player need 2 be updated i tried 2 download this Flash Player @ least a Hundred times and it stil doesn't Work Pers
-
I recently bought Adobe Creative Suite 2 and attempted to install it on my PowerPC G4 with Mac OS 10.2.8 installed. However, before the installation could begin, the installer does a background computer check to see if the computer is able to handle
-
Hello Everyone. I just purchased Photoshop Elements 9 and I have just joined the Adobe Forum. I am an amateur photographer with a challenge. I am creating slideshows for family, and before I go any further, I need to get some questions answered about
-
Attaching a searchhelp to a parameter
How can we attach a searchhelp to a parameter or select-option? regards cs
-
Problem with Flex Builder 4 Plugin and SpringSource 2.3.2.RELEASE
I am getting following error while opening up a Flex project. The file icons are showing up correctly but then it is creating a stream of following errors.Any help is appreciated. Session Data eclipse.buildId=2.3.2.201003230009-RELEASE java.version=1