How to assigne value in sub record type
Dear below mention record type database,now i want to assigne value in payr_rec type,in this recrocrd type have one column party_id,but how can assigne value int this field ,
TYPE group_rec_type IS RECORD(
group_name VARCHAR2(255),
group_type VARCHAR2(30),
created_by_module VARCHAR2(150),
-- Bug 2467872
mission_statement VARCHAR2(2000),
application_id NUMBER,
party_rec PARTY_REC_TYPE := G_MISS_PARTY_REC
please guide.
to get the desired default party_rec attribute value, just assign the "sub-record" attribute defaults as desired; PL/SQL will assign a default (non-null) record as the party_rec value using those attribute defaults:
create or replace package P_Test_It
as
type party_rec_type is record (
dummy varchar2(1) default 'X'
type group_rec_type is record (
group_name VARCHAR2(255),
group_type VARCHAR2(30),
created_by_module VARCHAR2(150),
-- Bug 2467872
mission_statement VARCHAR2(2000),
application_id NUMBER,
party_rec PARTY_REC_TYPE
end;
set serveroutput on
declare
rec p_test_it.group_rec_type;
begin
dbms_output.put_line(rec.party_rec.dummy);
end;
X
PL/SQL procedure successfully completed.Hope it helps.
Gerard
Similar Messages
-
How to assign values into nested table type in plsql
hi all,
I feel some what difficult to return user defined types from plsql function and procedures .
Can any one help me to learn this .
Version details are as follow
BANNER
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL>
create or replace type emp_names_nt is table of varchar2(100);
/* Formatted on 2012/04/05 15:23 (Formatter Plus v4.8.8) */
CREATE OR REPLACE FUNCTION get_emp_names
RETURN emp_names_nt
IS
CURSOR ec
IS
SELECT ename
FROM emp;
v_emp_names emp_names_nt := emp_names_nt ();
BEGIN
FOR i IN ec
LOOP
v_emp_names.EXTEND ();
v_emp_names (i) := i.ename;
END LOOP;
RETURN v_emp_names;
END;
Error :
PL/SQL: Statement ignored
PLS-00382: expression is of wrong typeThanks in advance .............
Thanks,
P PrakashCREATE OR REPLACE FUNCTION get_emp_names
RETURN emp_names_nt
IS
CURSOR ec
IS
SELECT ename
FROM scott.emp;
v_emp_names emp_names_nt := emp_names_nt();
cnt number:=1;
BEGIN
FOR i IN ec
LOOP
v_emp_names.EXTEND;
v_emp_names(cnt) := i.ename;
cnt:=cnt+1;
END LOOP;
RETURN v_emp_names;
END;
show errors -
How to assign Values to nested table and pass as parameter to procedure?
How to assign Values to nested table and pass as parameter to procedure?
Below is the Object and its type
create or replace type test_object1 as object
val1 varchar2(50),
val2 varchar2(50),
val3 varchar2(50)
create or replace type test_type1 is table of test_object1;
create or replace type test_object2 as object
val1 varchar2(50),
val2 varchar2(50),
val3 varchar2(50)
create or replace type test_type2 is table of test_object2;
GRANT ALL ON test_object1 TO PUBLIC;
GRANT ALL ON test_type1 TO PUBLIC;
GRANT ALL ON test_object2 TO PUBLIC;
GRANT ALL ON test_type2 TO PUBLIC;
here is the table made of object type:
create table test_object_tpe
sl_num NUMBER,
description VARCHAR2(100),
main_val1 test_type1,
main_val2 test_type2
NESTED TABLE main_val1 STORE AS tot1
NESTED TABLE main_val2 STORE AS tot2;
here is the procedure which inserts values into nested table:
PROCEDURE INSERT_TEST_DATA(sl_num IN NUMBER,
description IN VARCHAR2,
p_main_val1 IN test_type1,
p_main_val2 IN test_type2
IS
BEGIN
FOR rec in p_main_val1.first..p_main_val1.last
LOOP
INSERT INTO xxdl.test_object_tpe
sl_num,
description,
main_val1,
main_val2
VALUES
sl_num
,description
,test_type1 (test_object1(
p_main_val1(rec).val1,
p_main_val1(rec).val2,
p_main_val1(rec).val3
,test_type2 (test_object2( p_main_val2(rec).val1,
p_main_val2(rec).val2,
p_main_val2(rec).val3
END LOOP;
commit;
END INSERT_TEST_DATA;
here is the anonymoys block which assigns values to the object type and pass values into the procedure:
set serveroutput on;
declare
p_sl_num NUMBER := 1001;
p_description VARCHAR2(50) := 'Testing Val1';
inval1 test_type1 := test_type1();
inval2 test_type2 := test_type2();
begin
inval1(1).val1 := 'testx1';
inval1(1).val2 := 'testx2';
inval1(1).val3 := 'testx3';
inval2(1).val1 := 'testy1';
inval2(1).val2 := 'testy2';
inval2(1).val3 := 'testy3';
CSI_PKG.INSERT_TEST_DATA(sl_num => p_sl_num,
description => p_description,
p_main_val1 => inval1,
p_main_val2 => inval2
end;
Can anybody correct me.
Thanks,
LavanThanks for posting the DDL and sample code but whenever you post provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION).
>
How to assign Values to nested table and pass as parameter to procedure?
>
Well you are doing almost everything wrong that could be done wrong.
Here is code that works to insert data into your table (the procedure isn't even needed).
declare
p_sl_num NUMBER := 1001;
p_description VARCHAR2(50) := 'Testing Val1';
inval1 test_type1 := test_type1();
inval2 test_type2 := test_type2();
begin
inval1.extend();
inval1(1) := test_object1('testx1', 'testx2', 'testx3');
inval2.extend();
inval2(1) := test_object2('testy1', 'testy2', 'testy3');
INSERT INTO test_object_tpe
sl_num,
description,
main_val1,
main_val2
VALUES
(p_sl_num, p_description, inval1, inval2);
commit;
end;
/See Example 5-15 Referencing a Nested Table Element in Chap 5 Using PL/SQL Collections and Records in the PL/SQL doc
http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/collections.htm#CJABEBEA
1. You don't even need the procedure since all it does is a simple INSERT into the table which you can do directly (see my code above)
inval1(1).val1 := 'testx1';There is no element one (1) of 'inval1' since you haven't created any elements yet. You need to EXTEND the collection to add an element
inval1.extend();And then there is an empty element but 'inval1' is a container for objects of type 'test_object1' not for scalars like 'val1', 'val2', and 'val3'.
So you can't do
inval1(1).val1 := 'testx1';You have to create an instance of 'test_object1'
inval1(1) := test_object1('testx1', 'testx2', 'testx3');And so on for the other collection
You don't need the procedure (as my sample code shows) but once you populate the variables properly it will work. -
How to assign values for more than one field
Hi,
I have written following code
constants: fieldname(30) value '(SAPMF02D)KNA1-AUFSD'.
constants: fieldname1(30) value '(SAPMF02D)KNA1-LISFD'.
constants: fieldname2(30) value '(SAPMF02D)KNA1-FAKSD'.
field-symbols: <L_FIELD> TYPE ANY.
field-symbols: <L_FIELD1> TYPE ANY.
field-symbols: <L_FIELD2> TYPE ANY.
Assign (fieldname) to <l_field>.
<L_FIELD> = 'ZB'. " value according to your requirement
Assign (fieldname1) to <l_field1>.
<L_FIELD1> = 'ZB'.
while debugging <l_field1> is not assinging (fieldname1).
Im able to assing for (fieldname).
how to assign value for (fieldname1).
plz suggest me to assign values for more than one field.
Regards,
BrahmajiHello,
Because there is no field name called LISFD in KNA1. Actually you misspelled the field name.
It is KNA1-LIFSD -
How to assign values to server group when you parallelly client-copying
Hello all,
I'm now trying to create server group.
Currently, I use serial process, or default settings, when client-copying.
But I want to implement this in parallel processes.
Due to this, I have to create server group and assign a lot of values to something I don't know!
I want to create a server group, but don't know how to assign values to ones like "Max. requests in queue", "Max. no of logons" and so on.
Could you please advise me how to allocate values to the resourses shown below;
Advanced : 1 *I think "1" is the flag for advanced settings
Max. requests in queue
Max. no. of logons
Max. disp. of own logon
Max. no. of WPs used: *should be the total of SM50, I guess
Min. no. of free WPs
Max. no. of comm. entries
Max. wait time
thanks in advance,
HozyHi,
Would you check this [Parallel Processes |http://help.sap.com/saphelp_sm32/helpdata/EN/e8/df959834ac11d586f90000e82013e8/frameset.htm] and [Parallel processes FAQ|http://www.saptechies.com/ccinfo-parallel-processes-faq/] i hope will get some hint.
Regards
Mohan Rao -
How to assign values to Dynamic VO.
Hi All,
I have created a Dynamic VO and i have created 2 attributes(name and age) for it.
Can i create this dynamic VO in Process form request of one of the CO class?
Please let me know how to assign values to it......and display it and the page.?
Thanks,
Sowmya.Mukul
I am trying to achieve something like below:
Creating a Dynamic VO in my extended controller's ProcessRequest() method and attaching it to a MessageChoiceBean. In ProcessFormRequest() method based on some condition i have to change my Dynaic VO's whereClauseParam and re-execute it so that it will show some different set of values. Below is the code which i used. But after re-executing it my LOV is still showing old set of values. I have posted a query regd. the same but dint get much help. Kindly let me know, if you have any comments. Also Please find the link to my earlier post.
Link: Re: Re-executed dynamic VO not showing new values
* CODE *
ProcessRequest()
ViewObject vo = (ViewObject)am.createViewObjectFromQueryStmt("dummyVO","SELECT MEANING AS VALUE FROM HR_LOOKUPS WHERE LOOKUP_TYPE = :1");
vo.setMaxFetchSize(-1);
vo.setWhereClauseParam(0,"input1");
vo.executeQuery();
OAMessageChoiceBean mesBean=(OAMessageChoiceBean)webBean.findIndexedChild(webBean,"DemoChoiceItem");
mesBean.setPickListCacheEnabled(false);
mesBean.setPickListViewObjectDefinitionName("dummyVO ");
mesBean.setPickListViewUsageName("dummyVO ");
mesBean.setListDisplayAttribute("VALUE");
mesBean.setListValueAttribute("VALUE");
ProcessFormRequest()
If the event is fired
S.O.P(....);
ViewObject vo1 = (ViewObject)am.findViewObject("dummyVO");
vo1.clearCache();
vo1.reset();
vo1.setWhereClause(null);
vo1.setWhereClauseParams(null);
vo1.setWhereClauseParam(0,"input2");
vo1.executeQuery();
S.O.P(....);
Thanks -
How to assign values to JTable using mysql database
how to assign value to JTable using mysql...
Search the forum. You use the values of the "ResultSet" to create a "DefaultTableModel" which you then add to the "JTable".
I'll let you pick the search keywords to use, which I've suggested above. You can also throw in my userid if you want to specifically look for my solution. -
Hi, plz help me how to assign my PO to output types
plz help me how to assign my PO to output types through Nace t-code.what form routine?
Murli,
the settings in MN05 for PO.
NACE is the Tcode used to link the Application type, Output Types and its processing Routines like ( Driver programs and attached Script forms or Smartforms).
You should know the Application of a document first Like:
for PO it is EF, for sales Doc's it is V1, for Delivery docs it is V2, for billing Doc's it is V3 etc.
so first select the Application type (ex: EF) for PO and press OUtput types
then a list will come in that you should know the related output type for PO.
select any outtype and click on the processing Routines button on the left side
it will display the Medium, Driver Program and the Script form or smartform related to that document..
Reward points if it is helpful..
Amit. -
How to create a LookUp field, selecting a value from another record type ??
Hello all,
I am looking to create a new field in Opportunity in CRM On Demand where we can give the user an option to select one of the records. Data in this search applet should come from another Record Type in CRM On Demand. I am not able to find any similar literature in the Help books.
I would appreciate if somebody could give me real life steps please.
Thanks a lotOkay. I found the solution to this.
Now, along with this single reference, we also wish to bring the values of some more joined fields from the other record type in the Opportunities screen.
We were hoping that the Default value, and using fx, we should be able to achieve this using "joinedfieldvalue". However, it's not bringing back any value. Our expression is -
JoinFieldValue('<CustomObject3>',[<CustomObject3Id>],'<stState_ITAG>')
Please help if you have done this before.
Thanks & Regards -
Assign value to a record in a loop?
I have the record as following:
TYPE Curr_Select_Rec IS RECORD
ser_date date,
blk_route varchar210)
p_select Curr_Select_Rec;
How do I assign value to it in a loop?
I know I can do this
p_select.blk_route := 'aaaa';
but in the loop
Loop
How??????
end loop;
NEXT, LAST, FIRST Did not work
nullHi,
here a little package I wrote to select a table into a plsql_table and to work with the pl/sql table .
Package STIL_utils
IS
type r_export_tags is record
(bezeichnung stilvorlagen.bezeichnung%TYPE,
start_tag stilvorlagen.text_beginn%TYPE,
end_tag stilvorlagen.text_ende%TYPE);
type t_export_tags is table of r_export_tags
index by binary_integer;
procedure fill_tag_table(p_export_tags in out t_export_Tags,
p_export_typ in varchar2);
procedure show_tag_table(p_export_tags in t_export_Tags);
procedure find_tag(p_export_tags in out t_export_tags,
p_export_typ in varchar2,
p_tag_typ in varchar2,
p_start_tag in out stilvorlagen.text_beginn%TYPE,
p_end_tag in out stilvorlagen.text_ende%TYPE);
END; -- Package Specification UTL_STIL
Package Body STIL_utils
IS
-- Stilvorlagen Array
procedure show_tag_table(p_export_tags in t_export_tags)
is
v_index number;
v_index_last number;
begin
v_index := p_export_tags.first;
v_index_last := p_export_tags.last;
loop
dbms_output.put_line(p_export_Tags(v_index).bezeichnung);
dbms_output.put_line(p_export_Tags(v_index).start_tag);
dbms_output.put_line(p_export_Tags(v_index).end_tag);
exit when v_index = v_index_last;
v_index := p_export_Tags.next(v_index);
end loop;
end;
procedure fill_tag_table(p_export_tags in out t_export_Tags,
p_export_typ in varchar2)
is
cursor tags is
select bezeichnung,text_beginn,text_ende
from stilvorlagen
where bezeichnung like p_export_typ| |'_%'
and loesch_kz is null;
v_count number := 0;
--Prozedur zur Ermittlung welche Tags verwendet werden sollen.
-- Aus der Tabelle Stilvorlagen wird ein Array mit den Start und
--Ende Tags des entsprechenden Export Typs gef|llt.
begin
for rec in tags
loop
p_export_tags(v_count).bezeichnung := rec.bezeichnung;
p_export_tags(v_count).start_tag := rec.text_beginn;
p_export_tags(v_count).end_tag := rec.text_ende;
v_count := v_count + 1;
end loop;
--show_tag_table(p_export_tags);
end;
procedure find_tag(p_export_tags in out t_export_tags,
p_export_typ in varchar2,
p_tag_typ in varchar2,
p_start_tag in out stilvorlagen.text_beginn%TYPE,
p_end_tag in out stilvorlagen.text_ende%TYPE)
is
v_index number;
v_index_last number;
v_bezeichnung stilvorlagen.bezeichnung%TYPE;
begin
v_index := p_export_tags.first; --Arrayindex setzen
v_index_last := p_export_Tags.last; --Abbruchkriterium ermitteln
p_start_tag := null;
p_end_tag := null;
loop
v_bezeichnung := p_export_tags(v_index).bezeichnung;
-- Ist das der richtige Tag?
if v_bezeichnung = p_export_typ| |'_'| |p_tag_typ then
p_start_Tag := p_export_tags(v_index).start_Tag;
p_end_Tag := p_export_tags(v_index).end_Tag;
-- Tag gefunden also raus
exit;
else
-- Wenn alle getestet, dann raus
exit when v_index = v_index_last;
-- Ndchstes Feld aus Array
v_index := p_export_Tags.next(v_index);
end if;
end loop;
end;
END; -- Package Body UTL_STIL
Hope that helps
Detlev
null -
Assigning value to variable of type time
Hi,
I want to assign value '8:00:00' to a time variable (w_time like sy-uzeit).
How do i do this? Do i need to do any casting?
w_time = '8:00:00' didnt work.
I am trying to use this in a customer exit.
Thanks,
Arun KKGotcha!
Thanks!! -
How to pass values to XML complex type of a Webservice using PL/SQL
HI,
I need to call a web service from PL/SQL that has an complex type element. That complex type element has 4 child elements each of integer type.
I want to pass values for this complex type using SOAP_API.add_parameter but I can't understand how to pass the values.
<xsd:element name="getBestFit">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="circleId" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="usage" type="Q1:UsageInfoType"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<complexType name="UsageInfoType">
<sequence>
<element maxOccurs="1" minOccurs="1" name="a1" type="int"/>
<element maxOccurs="1" minOccurs="1" name="a2" type="int"/>
<element maxOccurs="1" minOccurs="1" name="a3" type="int"/>
<element maxOccurs="1" minOccurs="1" name="a4" type="int"/>
</sequence>
</complexType>
Please help me in getting a solution here.
Thanks in advance.Have you tried doing a google search on "SOAP_API.add_parameter" to see what comes back? I see a lot of hits come back so hopefully one of those will help you. I've never used soap_api as I used utl_http to make WS calls. This required me to build the SOAP message (aka XML of a specific nature) by hand and then pass it to the WS using utl_http. How this approach is done via SOAP_API, I can't say.
-
How to register OUT param to RECORD type for STORED PROCEDURE???
hi
i have a SP like this
CREATE OR REPLACE PACKAGE P1 AS
TYPE g_con_ref_cursor is REF CURSOR ;
TYPE g_con_error IS RECORD
error_code NUMBER,
error_desc varchar2(2000)
PROCEDURE PROC_CURSOR
(i_str_userid IN VARCHAR2,
o_cur_ref_cur OUT g_con_ref_cursor,
o_rec_error OUT g_con_error,
o_num_status OUT NUMBER);
END;and now i am trying to call this SP using my java program
i am able to register the out put params for 2nd and 4 th variable
my doubt is how i can register the output param for 3rd (g_con_error) which is of record type
and how i can get result from this ????
my java program is like this
Connection connection = DatabaseHelper.prepareConnection();
CallableStatement proc = connection.prepareCall("{ call P1.PROC_CURSOR(?, ?, ?, ?) }");
proc.setString(1,"jn26557");
proc.registerOutParameter(2,oracle.jdbc.driver.OracleTypes.CURSOR);
proc.registerOutParameter(3,???,????); //HOW TO SET THIS ?????
proc.registerOutParameter(4,oracle.jdbc.driver.OracleTypes.NUMERIC);
proc.execute();plz help me in this
i have no idea how to do it
any help would be appreciated
Thanks in advance
Jaya Prakash NalajalaYou might give a try using:
proc.registerOutParameter(3, java.sql.Types.REF, "RECORD"); -
Assigning value in the records
Hi,
I have a business scenario in which I am creating vendor and extending it for 320 company codes.
Now suppose I have to make change in the phone number in the data manager in place of XYZ to ABC.
Do I have to go and make change 320 place in the data manager or there is any method by the help of validation rule. So that I will write that rule and run on the set of the record automatically system will change phone number for those set of records from XYZ to ABC.
If you know any such validation or with help of assignment rules then please just let me know that validation rule or u have any idea please do share with me.
Thanks,
RohitHi Rohit,
if(phone_number = XYZ , ABC , phone_number)
See we are checking the phone_number filed, first we are checking for the condition; which in this case is wether the value of any row in phone_number column is 'XYZ' if it matches the replace it with 'ABC' else preserve the same value which exists.
for example
phone_number
III
ABC
UEU
XYZ
KKK
LLL
JDD
suppose these are the values under phone_number field and we are applying assignment to all of them; now it will first check as
III = XYZ it does not match so III is preserved.
ABC = XYZ it does not match so III is preserved
XYZ = XYZ it does match so XYZ is replaced with ABC
in this way records are compared and values are changed.
If you do not provide the else statement then MDM considers the default values as "TRUE" and assigns it to the record. so its must to provide the else value in the if statement to have the expression completed.
I hope this will clear you dought; any thing else please let me know
Regards,
Charan -
How to use temporarly table wid record type
Hi,
how to use temporarly table wid the record type wid this example
declare
type empcurtyp is ref cursor;
type rectype is record (veid t.emp_id%type, vename t.ename%type);
TYPE tabtype IS TABLE OF rectype;
empcv empcurtyp;
vtab tabtype;
begin
open empcv for select emp_id,ename from t;
loop
fetch empcv into vtab;
exit when empcv%notfound;
dbms_output.put_line(vtab.vename||vtab.veid);
end loop;
close empcv;
end;
here we hav table t and i m taking only two fields of the table t which r emp_id and ename.Try this
declare
type rectype is record (veid t.emp_id%type, vename t.ename%type);
type empcurtyp is ref cursor return rectype;
TYPE tabtype IS TABLE OF rectype;
empcv empcurtyp;
vtab empcv%rowtype;
begin
open empcv for select emp_id,ename from t;
loop
fetch empcv into vtab;
exit when empcv%notfound;
dbms_output.put_line(vtab.vename||vtab.veid);
end loop;
close empcv;
end;
Maybe you are looking for
-
Delivery costs with no material
Hi gurus: I have a situation, i need to create a PO with Account assignment category "K" and with no material, only text description, and I put de G/L account number and cost Center. I want to calculate the delivery cost but in the transaction MI
-
I have tried to change the config settings in line with a lsited posting, and these are: network.proxy.type =1 network.proxy.http = setting from IT dept. network.proxy.http_port = 8080 Is there anything else I should do?
-
Hi , We have created web service in development system and shared the WSDL file to be consumed in ERP(non sap) system. Now, we have to move the web service to production system. So, how the WSDL file will take the production system URL? It will happe
-
Add hyperlink to Notes app?
Does the Mountain Lion notes app allow you to add hyperlinks like you could back in Snow Leopard 10.6.8/when notes was part of the mail app? Thanks for any insight!
-
How to migrate win_api_shell functions
Hello, I am migrating a C/S Forms 6i application to webforms 10g. Most of the old d2kwutil.pll functionality is ported/replaced by webutil 1.0.5. But it seems that there is no ported version of the old win_api_shell functionality. As far as I can see