Passing record type into function [error: identifier must be declared]
Hi,
I have a record type defined in my procedure
type chk_tab is record(
effect date,
count number(9)
type chk_typ is table of chk_tab index by binary integer;
chk_typ_rec chk_typ;
I have to pass the effect and count into another function, i tried doin as below:
function name: func_chk_typ
func_chk_typ(effect, count);
this returns an saying "identifier effect needs to be declared"
I am required to pass these values from the record type into the function, How can i over come this??
Any help is very much appreciated.
Hi Hemz,
Find below code.
Function Code:
CREATE OR REPLACE FUNCTION fetch_band(eff in date,ineff in date)
return number
is
lu_cb_sysid NUMBER;
BEGIN
select fk_cb_sysid
into lu_cb_sysid
from ia_for_icon
where cr_ans_date >= eff
and cr_ans_date < ineff;
RETURN lu_cb_sysid;
END fetch_band;Procedure code. Here I have embedded the function.
CREATE OR REPLACE procedure abc(a varchar, b number) is
type cns_tab_record is record(
eff date,
ineff date);
type cns_tab_typ is table of cns_tab_record index by binary_integer;
cns_tab cns_tab_typ;
v_lu_cb_sysid NUMBER;
BEGIN
-- Here you have to assign the values to your table type record.
-- For example I am passing two values SYSDATE and SYSDATE - 10
cns_tab(1).eff := SYSDATE;
cns_tab(1).ineff := SYSDATE - 10;
v_lu_cb_sysid:= fetch_band(cns_tab(1).eff, cns_tab(1).ineff);
END abc;But I am just wondering why you are using table type datatype here.
Hope above code will help you.
Thanks,
Suri
Similar Messages
-
Error passing in RECORD type into API
Gurus,
Getting the following error when I try and pass a RECORD type into an API. Am I passing it in properly?
Any help is appreciated.
Thanks,
-Scott
Here's my error:
fnd_descr_flex_col_usage_pkg.load_row
ERROR at line 21:
ORA-06550: line 21, column 4:
PLS-00306: wrong number or types of arguments in call to 'LOAD_ROW'
ORA-06550: line 21, column 4:
PL/SQL: Statement ignored
Here's my anon block:
declare
TYPE who_type IS RECORD
created_by NUMBER,
creation_date DATE,
last_updated_by NUMBER,
last_update_date DATE,
last_update_login NUMBER
v_who_type who_type;
v_sysdate date;
begin
select sysdate
into v_sysdate
from dual;
v_who_type.created_by := 0;
v_who_type.creation_date := v_sysdate;
v_who_type.last_updated_by := 0;
v_who_type.last_update_date := v_sysdate;
v_who_type.last_update_login := 0;
fnd_descr_flex_col_usage_pkg.load_row
(x_application_short_name => 'SPL',
x_descriptive_flexfield_name => 'HR_LOCATIONS' ,
x_descriptive_flex_context_cod => '441',
x_application_column_name => 'ATTRIBUTE5',
x_who => v_who_type,
x_end_user_column_name => 'District',
x_column_seq_num => 10,
x_enabled_flag => 'Y',
x_required_flag => 'N',
x_security_enabled_flag => 'N',
x_display_flag => 'Y',
x_display_size => 50,
x_maximum_description_len => 50,
x_concatenation_description_le => 25,
x_flex_value_set_name => '50 Characters',
x_range_code => '',
x_default_type => '',
x_default_value => '',
x_runtime_property_function => '',
x_srw_param => '',
x_form_left_prompt => 'District',
x_form_above_prompt => 'District',
x_description => '');
...I followed Tubby's advice and called the package to which the RECORD type was defined, however, I'm getting a "no data found" error in the called package. The purpose of "internally" definining the record type inside my Anon block was so that I could assign variables locally.
Help from you gurus would be greatly appreciated!
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at "APPS.FND_DESCR_FLEX_COL_USAGE_PKG", line 508
ORA-06512: at line 21
Please do not refer me to any more EBS forums or links. This is a coding question, not an EBS question.
For the guy who asked, here is the procedure definition:
PROCEDURE load_row
(x_application_short_name IN VARCHAR2,
x_descriptive_flexfield_name IN VARCHAR2,
x_descriptive_flex_context_cod IN VARCHAR2,
x_application_column_name IN VARCHAR2,
x_who IN fnd_flex_loader_apis.who_type,
x_end_user_column_name IN VARCHAR2,
x_column_seq_num IN NUMBER,
x_enabled_flag IN VARCHAR2,
x_required_flag IN VARCHAR2,
x_security_enabled_flag IN VARCHAR2,
x_display_flag IN VARCHAR2,
x_display_size IN NUMBER,
x_maximum_description_len IN NUMBER,
x_concatenation_description_le IN NUMBER,
x_flex_value_set_name IN VARCHAR2,
x_range_code IN VARCHAR2,
x_default_type IN VARCHAR2,
x_default_value IN VARCHAR2,
x_runtime_property_function IN VARCHAR2,
x_srw_param IN VARCHAR2,
x_form_left_prompt IN VARCHAR2,
x_form_above_prompt IN VARCHAR2,
x_description IN VARCHAR2) -
Passing Record type parameter from one session to other session
Hi,
I have a package.procedure, in that I am calling custom workflow, inside this workflow again I am calling
same package.procedure (Its an recursive call)
I need to pass record type parameter in this package.procedure.
I tried with global variables but Workflow starts its new session so it losses all variables.
Now I am going with creation of Custom table.
Please advice, is there any way other than creation of Custom table.
I mean can we pass Record type parameter from one session to other session without creating table.
Regards
RohitAl-Salamu Alikum We Rahmatu Allah We Barakatu...
want this place from to be passed as a parameter to the shipping bill form..... using web.show_documentwhy don't u think of just passing data parameter or global parameters from one form to another
Pass global variable between two forms.
Hope this helps...
Regards,
Abdetu... -
Dba_role_privs identifier must be declared ?
hello,
I have problem with dba_role_privs.
It's work if I put this code in SQL Plus, but if I put it in forms and compile, there I get error dba_role_privs must be declared. When I use user_role_privs is ok.
code:
DECLARE
nazwa_roli varchar2(30):= 'PRACOWNIK';
BEGIN
SELECT granted_role INTO nazwa_roli FROM dba_role_privs
WHERE (granted_role LIKE ('ADMINISTRATOR') OR granted_role LIKE ('NADZORCA') OR granted_role LIKE('PRACOWNIK'))
AND grantee = upper(:comp_prac.login);
:comp_prac.radio_group := nazwa_roli;
END;
I think maybe problem is with privileges for scott but in SQL Plus it's work.Hello
Is this the same account.
Now I solved this problem. I use forms_ddl(SELECT......); and it working.
thanks for reply.
But is another problem :). If I use forms_ddl(); , I can't get real value with select clause to variable nazwa_roli and I get default value 'PRACOWNIK'
any idea?
this code working in SQL Plus
DECLARE
nazwa_roli varchar2(30) := 'PRACOWNIK';
BEGIN
SELECT granted_role INTO nazwa_roli FROM dba_role_privs
WHERE (granted_role LIKE ('ADMINISTRATOR') OR granted_role LIKE ('NADZORCA') OR granted_role LIKE('PRACOWNIK'))
AND grantee = upper('ZDZISIEK');
dbms_output.put_line('nazwa:' || nazwa_roli);
END;
and this not working in forms trigger WHEN_NEW_BLOCK_INSTANCE
DECLARE
nazwa_roli varchar2(30) DEFAULT 'PRACOWNIK';
BEGIN
forms_ddl('SELECT granted_role INTO' || nazwa_roli || ' FROM dba_role_privs
WHERE (granted_role LIKE ("ADMINISTRATOR") OR granted_role LIKE ("NADZORCA") OR granted_role LIKE("PRACOWNIK"))
AND grantee = ' || upper(:comp_prac.login));
:comp_prac.radio_group := nazwa_roli;
message ('nazwa roli:'|| nazwa_roli);
END;
Edited by: user515960 on 2010-06-14 00:56
I solved it.
grant select on sys.dba_role_privs; and I remove forms_ddl();
Edited by: user515960 on 2010-06-14 01:37 -
Cursor Error in trigger - Statement Ignored/identifier must be declared PLS
I have been asked to implement a trigger and believe I have the code complete but am getting a final error on the compile. I have been running in circles for a day trying to resolve my issue. I have no PL/SQL knowlege so have been pulling from a book and google. I have three Cursors defined and the third compiles fine, the first two give the below error though I can't see a significant difference between the three. I can't help but think it is something stupid I am not seeing but I am at a loss.
If I comment out the reference to the cursor it will compile with the cursor definition but as soon as I add the Open statement the errors below appear.
Any help would be greatly appreciated as my head is getting sore.
Thanks
Mike
Error(30,13): PL/SQL: Statement ignored
Error(30,20): PLS-00201: identifier 'CURSORGETFROMDISTMAKRERS' must be declared
Error(51,13): PL/SQL: Statement ignored
Error(51,20): PLS-00201: identifier 'CURSORGETTODISTMAKRERS' must be declared
-- Table I am writing to
create table IMSV7.CTRANSWODISTMARK (
WORKORDERKEY INTEGER,
DISTMARKFROM NUMBER (9,4),
DISTMARKFROMATTRIBUTE VARCHAR (10),
DISTMARKTO NUMBER (9,4),
DISTMARKTOATTRIBUTE VARCHAR (10)
-- Excerpt from the HISTORY table I am placing the trigger against
COMPKEY NUMBER (9,0)
DISTFROMFT FLOAT
DISTTOFT FLOAT
HISTKEY NUMBER (9,0)
-- Trigger code
CREATE OR REPLACE TRIGGER MaintainCTRANSWODISTMARK
AFTER INSERT or UPDATE of DISTFROMFT, DISTTOFT ON IMSV7.HISTORY
REFERENCING NEW as NewWO
FOR EACH ROW
BEGIN
DECLARE
-- Declare cursors
CURSOR CursorGetFromDistMarkers (WOCompKey IN NUMBER, WODistFromFT IN FLOAT) IS
SELECT ATTRCODE, DISTFROMFT, MARKERFROM from RWATTRDF DF, RWATTR A
where WOCompkey = A.COMPKEY AND DF.ATTRKEY = A.ATTRKEY and DF.ATTRTYPE = 'DISTMARK'
and WODistFromFT >= DISTFROMFT and WODistFromFT <= DISTTOFT
order by A.EFFDATE DESC, DISTFROMFT DESC;
FromDistanceMarker CursorGetFromDistMarkers%ROWTYPE;
CURSOR CursorGetToDistMarkers (WOCompKey IN NUMBER, WODistToFT IN FLOAT) IS
SELECT ATTRCODE, DISTFROMFT, MARKERFROM from RWATTRDF DF, RWATTR A
where WOCompkey = A.COMPKEY AND DF.ATTRKEY = A.ATTRKEY and DF.ATTRTYPE = 'DISTMARK'
and WODistToFT >= DISTFROMFT and WODistToFT <= DISTTOFT
order by A.EFFDATE DESC, DISTFROMFT DESC;
ToDistanceMarker CursorGetToDistMarkers%ROWTYPE;
CURSOR CursorGetCTRANSWODistMark (WOHistKey IN NUMBER) IS
SELECT WORKORDERKEY from CTRANSWODISTMARK
where WORKORDERKEY = WOHistKey;
CTRANSWODistMark CursorGetCTRANSWODistMark%ROWTYPE;
varDistmarkFrom NUMBER;
varDistmarkFromAttribute VARCHAR2(10);
varDistmarkTo NUMBER;
varDistmarkToAttribute VARCHAR2(10);
BEGIN
-- Process From measurement
IF NOT CursorGetFromDistMakrers%ISOPEN
THEN
OPEN CursorGetFromDistMarkers(:NewWO.COMPKEY, :NewWO.DISTFROMFT);
END IF;
FETCH CursorGetFromDistMarkers INTO FromDistanceMarker;
IF CursorGetFromDistMarkers%NOTFOUND
THEN
-- No distance markers found, use MILES
varDistmarkFrom := :NewWO.DISTFROMFT / 5280;
varDistmarkFromAttribute := 'MILES';
ELSE
-- Found a distance marker, convert to its units and use those
-- Distance is the Marker start distance plus the offset from that start of the marker
varDistmarkFrom := FromDistanceMarker.MARKERFROM + :NewWO.DISTFROMFT - FromDistanceMarker.DISTFROMFT;
varDistmarkFromAttribute := FromDistanceMarker.ATTRCODE;
END IF;
CLOSE CursorGetFromDistMarkers;
-- Process To measurement
IF NOT CursorGetToDistMakrers%ISOPEN
THEN
OPEN CursorGetToDistMarkers(:NewWO.COMPKEY, :NewWO.DISTTOFT);
END IF;
FETCH CursorGetToDistMarkers INTO ToDistanceMarker;
IF CursorGetToDistMarkers%NOTFOUND
THEN
-- No distance markers found, use MILES
varDistmarkTo := :NewWO.DISTTOFT / 5280;
varDistmarkToAttribute := 'MILES';
ELSE
-- Found a distance marker, convert to its units and use those
-- Distance is the Marker start distance plus the offset from that start of the marker
varDistmarkTo := ToDistanceMarker.MARKERFROM + :NewWO.DISTTOFT - ToDistanceMarker.DISTFROMFT;
varDistmarkToAttribute := ToDistanceMarker.ATTRCODE;
END IF;
CLOSE CursorGetToDistMarkers;
-- Check for existing record to know if we should add or update
IF NOT CursorGetCTRANSWODistMark%ISOPEN
THEN
OPEN CursorGetCTRANSWODistMark(:NewWO.HISTKEY);
END IF;
FETCH CursorGetCTRANSWODistMark INTO CTRANSWODistMark;
IF CursorGetCTRANSWODistMark%NOTFOUND
THEN
-- Record does not exist, add one
Insert into CTRANSWODISTMARK (WORKORDERKEY, DISTMARKFROM, DISTMARKFROMATTRIBUTE, DISTMARKTO, DISTMARKTOATTRIBUTE)
values (:NewWO.HISTKEY, varDistmarkFrom, varDistmarkFromAttribute, varDistmarkTo, varDistmarkToAttribute);
ELSE
-- Existing record, update it
Update CTRANSWODISTMARK set DISTMARKFROM = varDistmarkFrom, DISTMARKFROMATTRIBUTE = varDistmarkFromAttribute,
DISTMARKTO = varDistmarkTo, DISTMARKTOATTRIBUTE = varDistmarkToAttribute
Where WORKORDERKEY = :NewWO.HISTKEY;
END IF;
END;
END;
run;
show errors trigger MaintainCTRANSWODISTMARK;the cursor is mispelled
IF NOT CursorGetFromDistMakrers%ISOPENchange it to:
IF NOT CursorGetFromDistMarkers%ISOPEN -
Hi all,
I was creating and passing / getting back record types for calling a plsql method in bpel , until i came upon a method where i define a type ref cursor and get all the attributes in the ref cursor. This makes my application very generic as i can add as many out put parameters into the record type and get them in the xml. I just wanted to know the pros and cons of this approach . Is this better than defining a static record type and getting the values as the only changes i need to make if the calling application asks for more parameters would be in the backend code.
Thanks
-PradipAll interesting to know, but it all confirms what I thought all along: object types and its associated object cache were designed to manipulate table data not temporary data that was created and passed just to satisfy the temporary need to get data into a Pro*C/C application.
Thanks! But it looks like object types bring with them an amount of overhead that is not going to be suitable for our task. We'd constantly be bringing in the objects, consuming them, and then flushing them out of the cache because we'll be recreating them again next time (in the PL/SQL procedure) and they won't ever be the same. In order for this to change we'd need to redesign the entire thing, and while that is certainly something to keep in mind, for now we don't have the time!
If and when we decide to redesign, I will certainly take all this into consideration!
For my own edification, however, how much faster did you find the OCCI implementation over the Pro*C implementation? We don't use the OCI layer for anything yet, so this would be a first, and so I may have to sell its use.
Thanks!
-- Brian -
PL/SQL Passing record type between two procedures
I have a package and package body as following
My problem is I forgot the syntax to pass the record type between the two procedure.?????
CREATE OR REPLACE PACKAGE Standby_Schedules_Disp
AS
PROCEDURE Get_schedule (test1 OUT VARCHAR2);
PROCEDURE get_test (my_test REF my_sched); DOESN'T WORK?????
END Standby_Schedules_Disp;
CREATE OR REPLACE PACKAGE BODY Standby_Schedules_Disp
AS
PROCEDURE Get_schedule (test1 OUT VARCHAR2)
AS
temp NUMBER;
TYPE my_sched IS RECORD ( my_name VARCHAR2(30) := NULL,
my_age NUMBER := 0);
who_I_am my_sched;
Get_test(my_sched);
BEGIN
test1 := 'aaaaa';
who_i_am.my_name := 'Matthew';
END get_schedule;
PROCEDURE get_test (my_test REF my_sched) DOESN'T WORK?????
AS
BEGIN
END;
END Standby_Schedules_Disp;
/Youv'e declared the my_sched type within the scope of the Get_schedule procedure - it's not visible to the get_test procedure. You have declare the type in the package body if it's only used internally within the package or in the package spec if it can be referenced outside the package:
CREATE OR REPLACE PACKAGE [BODY] Standby_Schedules_Disp
AS
TYPE my_sched IS RECORD (
my_name VARCHAR2(30) := NULL,
my_age NUMBER := 0);I don't understand what you are trying to do with the REF keyword in this context. Having declared the type, you can use it as normal in a parameter spec:
PROCEDURE get_test (my_test IN [OUT] my_sched);You're also trying to call get_test within the declaration section of a program, which you can't do, and get_test also contains no executable code, which is not allowed in PL/SQL. -
Is possible pass class reference into function by reference ?
Hello, here is one example.
class MyClass
public int i;
public static void Change(MyClass param1, MyClass param2)
MyClass temp;
temp = param1;
param1 = param2;
param2 = temp;
public static void main(String[] args)
MyClass param1 = new Main();
param1.i = 100;
MyClass param2 = new Main();
param2.i = 200;
Change(param1,param2);
System.out.println(param1.i);
System.out.println(param2.i);
Is clear the result will be :
100
200
Well, is possible in java pass into function object reference by reference? (for example in C# exist keyword ref, which solve this problem.) Other question is if this is something what is really needed in daily programming life, but I'm curious.
Thanks for responseiaragorn wrote:
Well, is possible in java pass into function object reference by reference? No. Java only passes by value.
Other question is if this is something what is really needed in daily programming lifeNope. Java has done just fine without pass by reference for about 12 or 14 years now. -
PLS-00201 identifier must be declared
Hi All,
Can any one please help me regarding this error.
I am getting the PLS-00201 identifier tree_sorting must be declared at the line " Tree_Sorting(1, 0); ".
if i comment the " Tree_Sorting(1, 0); " at pkgfc_gi.v_cphase := '01-13'; and uncomment the " Tree_Sorting(1, 0); " at pkgfc_gi.v_cphase := '01-09' then the procedure is compiling successfully; This is my stored procedure.
Please help me in solving this.
CREATE OR REPLACE PACKAGE BODY FA_Main AS
/*-------------------------------- Calcul_FA -------------------------------*/
FUNCTION Calcul_FA (
p_client_group IN tfc_stc_client_groups.s_client_group%TYPE DEFAULT NULL,
p_admin_group IN tfc_stc_clients.c_admin_group %TYPE DEFAULT NULL,
p_client IN tfc_stc_clients.s_client %TYPE DEFAULT NULL,
p_report_group IN tfc_stc_report_groups.g_classification%TYPE DEFAULT NULL,
p_contract IN tfc_stc_contracts.s_contract %TYPE DEFAULT NULL,
p_fa_typ IN tfc_prm_fa_master.c_fa_typ %TYPE DEFAULT NULL,
p_fa IN tfc_prm_fa_master.s_fa %TYPE DEFAULT NULL,
p_beg_period IN DATE DEFAULT NULL,
p_end_period IN DATE DEFAULT NULL,
p_y_all_ok IN VARCHAR2 DEFAULT 'Y',
p_y_estimate IN VARCHAR2 DEFAULT 'N',
p_est_date IN DATE DEFAULT NULL)
RETURN NUMBER IS
----------------------------------------------------------------------- CURSEURS
-- List of FA to calculate --
CURSOR c_fa IS
SELECT pfm.s_fa s_fa, pfm.c_fa_typ c_fa_typ, sct.s_contract s_contract, srg.g_classification g_classification,
scl.s_client s_client, scl.c_admin_group c_admin_group, scg.s_client_group s_client_group
FROM tfc_prm_fa_master pfm, tfc_stc_contracts sct, tfc_stc_clients scl, tfc_stc_client_groups scg, tfc_stc_report_groups srg
WHERE pfm.c_fa_structure_typ = 'PARM'
AND ((p_fa IS NOT NULL AND pfm.s_fa = p_fa ) OR p_fa IS NULL)
AND ((p_fa_typ IS NOT NULL AND pfm.c_fa_typ = p_fa_typ ) OR p_fa_typ IS NULL)
AND ((p_contract IS NOT NULL AND sct.s_contract = p_contract ) OR p_contract IS NULL)
AND ((p_report_group IS NOT NULL AND srg.g_classification LIKE p_report_group||'%') OR p_report_group IS NULL)
AND ((p_client IS NOT NULL AND scl.s_client = p_client ) OR p_client IS NULL)
AND ((p_admin_group IS NOT NULL AND scl.c_admin_group = p_admin_group ) OR p_admin_group IS NULL)
AND ((p_client_group IS NOT NULL AND scg.s_client_group = p_client_group ) OR p_client_group IS NULL)
AND (NVL(p_client_group,NVL(p_client,NVL(p_contract, p_fa))) IS NOT NULL OR p_admin_group IS NOT NULL OR p_report_group IS NOT NULL)
AND (p_beg_period IS NULL OR ((p_beg_period IS NOT NULL AND pfm.d_first_calculation IS NOT NULL AND p_beg_period >= pfm.d_first_calculation) OR pfm.d_first_calculation IS NULL))
AND (p_end_period IS NULL OR ((p_end_period IS NOT NULL AND pfm.d_end_calculation IS NOT NULL AND p_end_period <= pfm.d_end_calculation) OR pfm.d_end_calculation IS NULL) OR (p_end_period IS NOT NULL AND sct.d_inception <= p_end_period ))
AND sct.s_contract = pfm.fk_contract
AND scl.s_client = sct.fk_client
AND scg.s_client_group (+)= scl.fk_client_group
AND srg.s_report_group (+)= sct.fk_report_group
AND pfm.y_fee_to_calculate = 'Y'
AND sct.c_contract_status = 'ACTIVE'
AND ROWNUM < 2;
BEGIN
COMMIT;
IF pkgfc_faed.v_y_estimate = 'Y' THEN
INSERT INTO tfc_log_application_master (
s_log, l_log,
d_t_begin_task,
c_application_task, c_task_status,
g_key_0, g_key_1,
g_key_2, g_key_3,
g_key_4, g_key_5,
g_key_6, g_key_7,
g_key_8, g_key_9)
VALUES (
pkgfc_faed.v_s_log, v_l_log, SysDate,
'ESTIMATE', 'RUNNING',
TRIM(TO_CHAR(p_client_group)), p_admin_group,
TRIM(TO_CHAR(p_client)), p_report_group,
TRIM(TO_CHAR(p_contract)), p_fa_typ,
TRIM(TO_CHAR(p_fa)), TO_CHAR(p_beg_period,'DD/MM/YYYY'),
TO_CHAR(p_end_period,'DD/MM/YYYY'), v_y_all_ok);
ELSE
INSERT INTO tfc_log_application_master (
s_log, l_log,
d_t_begin_task,
c_application_task, c_task_status,
g_key_0, g_key_1,
g_key_2, g_key_3,
g_key_4, g_key_5,
g_key_6, g_key_7,
g_key_8, g_key_9)
VALUES (
pkgfc_faed.v_s_log, v_l_log,
SysDate,
'CALCULATION', 'RUNNING',
TRIM(TO_CHAR(p_client_group)), p_admin_group,
TRIM(TO_CHAR(p_client)), p_report_group,
TRIM(TO_CHAR(p_contract)), p_fa_typ,
TRIM(TO_CHAR(p_fa)), TO_CHAR(p_beg_period,'DD/MM/YYYY'),
TO_CHAR(p_end_period,'DD/MM/YYYY'), v_y_all_ok);
END IF;
v_return := pkgfc_faed.v_s_log;
COMMIT;
-- Loop on all Fee/Alloc to calculate --
-- Added by Santhakumar
BEGIN
INSERT INTO tmp_prm_fa_details(
SELECT USERENV('SESSIONID') SESSION_ID,
LEVEL CUR_LEVEL,
(CASE WHEN (SELECT MAX(LEVEL)
FROM tfc_prm_fa_details fad2
WHERE fad2.fk_fa = fad1.fk_fa
START WITH fad2.s_fa_detail=fad1.s_fa_detail
CONNECT BY PRIOR fad2.s_fa_detail = fad2.fk_fa_detail_upper_level) > 1
THEN LEVEL + 1
ELSE LEVEL
END) NEXT_LEVEL,
fad1.s_fa_detail,
fad1.fk_fee_alloc_detail,
fad1.fk_fa,
fad1.l_fa_detail,
fad1.g_fa_4calculation,
fad1.fk_fa_detail_upper_level,
fad1.fk_third_party,
fad1.g_consolidation_rule,
fad1.c_fa_calculation_typ,
fad1.fk_aggregation_rule,
fad1.fk_scale,
fad1.g_scale_band_unit,
fad1.g_value,
fad1.n_detail_order,
fad1.y_ref_amount_equal_total_aum,
fad1.c_validation_status,
fad1.g_val_by,
fad1.d_t_val,
fad1.g_ins_by,
fad1.d_t_ins,
fad1.g_upd_by,
fad1.d_t_upd
FROM tfc_prm_fa_details fad1
START WITH fad1.fk_fa_detail_upper_level IS NULL
CONNECT BY PRIOR fad1.s_fa_detail = fad1.fk_fa_detail_upper_level
END;
-- Added by Santhakumar
pkgfc_gi.v_cphase := '00-02';
FOR v_fa IN c_fa LOOP
pkgfc_gi.v_cphase := '01-08';
DECLARE
-- Tree Sorting Recursive Procedure --
PROCEDURE Tree_Sorting (p_level IN NUMBER,p_fk_fa_detail_upper_level IN NUMBER) IS
-- Cursor to retrieve data at current level --
CURSOR c_tfd IS
SELECT *
FROM tfc_tmp_fa_details tfd
WHERE tfd.fk_fa = v_fa.s_fa
AND tfd.session_id = USERENV('SESSIONID')
AND tfd.cur_level = p_level
AND tfd.fk_fa_detail_upper_level = p_fk_fa_detail_upper_level
ORDER BY tfd.n_detail_order ASC;
Error_Found_in_Tree_Sorting EXCEPTION;
-------------------------------------------------------------------------- BEGIN
BEGIN
FOR v_tfd IN c_tfd LOOP
pkgfc_dts.put_nline('Level : '||TO_CHAR(v_tfd.cur_level)||' - '||v_tfd.g_fa_4calculation||' - '||TO_CHAR(p_fk_fa_detail_upper_level));
pkgfc_gi.v_cphase := '01-14';
pkgfc_faed.v_nb_fa_det := pkgfc_faed.v_nb_fa_det + 1;
pkgfc_faed.v_fa_details(pkgfc_faed.v_nb_fa_det) := v_tfd;
pkgfc_faed.v_nb_max_level := GREATEST(pkgfc_faed.v_nb_max_level,
pkgfc_faed.v_fa_details(pkgfc_faed.v_nb_fa_det).cur_level);
-- Break the link with Root Record --
IF (pkgfc_faed.v_fa_details(pkgfc_faed.v_nb_fa_det).fk_fa_detail_upper_level = 0) THEN
pkgfc_faed.v_fa_details(pkgfc_faed.v_nb_fa_det).fk_fa_detail_upper_level := NULL;
END IF;
IF (v_tfd.cur_level < v_tfd.next_level) THEN
pkgfc_gi.v_cphase := '01-15';
Tree_Sorting(v_tfd.next_level, v_tfd.s_fa_detail);
END IF;
IF (pkgfc_gi.v_cretour <> '0') THEN
RAISE Error_Found_in_Tree_Sorting;
END IF;
END LOOP;
---------------------------------------------------------------------- EXCEPTION
EXCEPTION
WHEN Error_Found_in_Tree_Sorting THEN
IF (c_tfd%ISOPEN ) THEN CLOSE c_tfd ; END IF;
WHEN OTHERS THEN
IF (c_tfd%ISOPEN ) THEN CLOSE c_tfd ; END IF;
pkgfc_gi.v_cretour := '9'; -- When Others Error
pkgfc_gi.v_cproc := 'FA_Engine_Main.Tree_Sorting';
pkgfc_gi.v_mess := SUBSTR(SQLERRM(SQLCODE), 1, 255);
pkgfc_dts.put_nline('Err : '||pkgfc_gi.v_cretour||' - '||pkgfc_gi.v_cphase||' - '||pkgfc_gi.v_cproc||' - '||pkgfc_gi.v_mess);
---------------------------------------------------------------------------- END
END Tree_Sorting;
PROCEDURE Autonomous_0108 IS
PRAGMA AUTONOMOUS_TRANSACTION; -- Permit Commit/Rollback independently of the current transaction
BEGIN
-- Clean Temporary Table --
pkgfc_gi.v_cphase := '01-09';
DELETE tfc_tmp_fa_details WHERE session_id NOT IN (SELECT DISTINCT audsid FROM all_sessions);
COMMIT;
--Tree_Sorting(1, 0);
END Autonomous_0108;
BEGIN
Autonomous_0108;
END;
-- Get FA Details from Prm_Fa_Details --
pkgfc_gi.v_cphase := '01-10';
select count(1) into v_num from tfc_tmp_fa_details;
Dbms_output.put_line('first' || v_num);
Dbms_output.put_line('Session Id --> ' || USERENV('SESSIONID'));
INSERT INTO tfc_tmp_fa_details (SELECT * FROM tmp_prm_fa_details WHERE fk_fa = v_fa.s_fa);
-- Insert a Root Record for Tree Sorting purpose --
pkgfc_gi.v_cphase := '01-11';
INSERT INTO tfc_tmp_fa_details (
session_id, cur_level, next_level,
s_fa_detail, fk_fa, fk_fa_detail_upper_level)
VALUES (
USERENV('SESSIONID'), 0, 1,
0, v_fa.s_fa, NULL);
-- Link the Level 1 with Root Level (0) --
pkgfc_gi.v_cphase := '01-12';
UPDATE tfc_tmp_fa_details
SET fk_fa_detail_upper_level = NVL(fk_fa_detail_upper_level, 0)
WHERE fk_fa = v_fa.s_fa
AND s_fa_detail > 0
AND session_id = USERENV('SESSIONID');
-- Sort FA Details Tree according n_detail_order field --
pkgfc_gi.v_cphase := '01-13';
Tree_Sorting(1, 0);
-- Clean Temporary Table --
pkgfc_gi.v_cphase := '01-16';
WHEN OTHERS THEN
dbms_output.put_line('OTHERS');
pkgfc_gi.eev_cur := v_eev_cur;
v_loop_ret := -1;
IF (c_fa%ISOPEN ) THEN CLOSE c_fa ; END IF;
IF (c_cli%ISOPEN) THEN CLOSE c_cli; END IF;
IF (c_ctr%ISOPEN) THEN CLOSE c_ctr; END IF;
IF (c_fam%ISOPEN) THEN CLOSE c_fam; END IF;
IF (c_cad%ISOPEN) THEN CLOSE c_cad; END IF;
IF (c_fad%ISOPEN) THEN CLOSE c_fad; END IF;
pkgfc_gi.v_cretour := '9'; -- When Others Error
pkgfc_gi.v_cproc := 'FA_Engine_Main.Calcul_FA';
pkgfc_gi.v_mess := SUBSTR(SQLERRM(SQLCODE), 1, 255);
pkgfc_dts.put_nline('Err : '||pkgfc_gi.v_cretour||' - '||pkgfc_gi.v_cphase||' - '||pkgfc_gi.v_cproc||' - '||pkgfc_gi.v_mess);
-------------------------------------------------------------------- END
END;
END LOOP;
return(v_return);
END Calcul_FA;
END FA_Main;
/It looks to me like procedure 'tree_sorting' is declared as a local procedure within a nested BEGIN .. END block (which spans lines 288 - 438). You cannot call this procedure outside that block, it is out of scope - you would have to move it to a higher scope.
It would help if you posted something remotely readable in future. -
Hi! I have an specific problem with this program with the variable CADENA
declare
cursor test_tabla is
select td_tabla, td_period, td_fec_ult_test
from ta_tx_test_tabla;
tt_tabla varchar2(20);
tt_period number;
tt_fec_ult date;
propietario varchar2(20);
cursor columnas is
select column_name, data_type
from all_tab_columns
where table_name = tt_tabla and owner=propietario;
bloquePLSQL varchar2(32767);
lineaAuxCol varchar2(3000);
lineaAuxCab varchar2(3000);
cadena varchar2(30);
begin
--recorremos la tabla para comprobar si ha vencido algun plazo
for tt in test_tabla loop
tt_tabla := tt.td_tabla;
tt_period := tt.td_period;
tt_fec_ult := tt.td_fec_ult_test;
if tt_fec_ult + tt_period < sysdate then
--ha vencido el plazo para ejecutar el test
--obtenemos el propietario de la tabla, que puede ser ANALSI o ANALTAURO
select owner into propietario
from all_tables where table_name=tt_tabla and (tablespace_name='SI_TAURO' or tablespace_name='TA_TAURO');
dbms_output.put_line( propietario );
bloquePLSQL := ' declare';
bloquePLSQL := bloquePLSQL || ' fichero utl_file.file_type;';
bloquePLSQL := bloquePLSQL || ' fecha date;';
bloquePLSQL := bloquePLSQL || ' result varchar2(30);';
bloquePLSQL := bloquePLSQL || ' cursor test is';
bloquePLSQL := bloquePLSQL || ' select * from '||propietario||'.' || tt_tabla || ' minus select * from analsepe.' || tt_tabla || ';';
bloquePLSQL := bloquePLSQL || ' begin ';
bloquePLSQL := bloquePLSQL || ' select sysdate into fecha from dual; ';
bloquePLSQL := bloquePLSQL || ' result := to_char(fecha,''ddmmyy'') || ''-'' || ''' || tt_tabla || '''; ';
bloquePLSQL := bloquePLSQL || ' dbms_output.put_line( result ); ';
bloquePLSQL := bloquePLSQL || ' fichero := utl_file.fopen(''/export/home/xmgm'', result||''.txt'', ''w'', 16384);';
lineaAuxCab := '*';
for col in columnas loop
lineaAuxCab := lineaAuxCab || rpad(col.column_name,20) || '*';
end loop;
bloquePLSQL := bloquePLSQL || ' utl_file.put_line(fichero, ''' || lineaAuxCab || ''');';
bloquePLSQL := bloquePLSQL || ' for rec_test in test loop';
lineaAuxCol := '''*''';
dbms_output.put_line('1 '||cadena);
for col in columnas loop
cadena:=null;
insert into cadena select decode(1,2,'X',rec_test.' || col.column_name || ') from dual;
dbms_output.put_line('2 '||cadena);
lineaAuxCol := lineaAuxCol || ' || rpad(nvl(cadena, '' ''),20) || ''*''';
end loop;
bloquePLSQL := bloquePLSQL || ' utl_file.put_line(fichero, ' || lineaAuxCol || ');';
bloquePLSQL := bloquePLSQL || ' end loop;';
bloquePLSQL := bloquePLSQL || ' utl_file.fclose(fichero);';
bloquePLSQL := bloquePLSQL || ' end;';
execute immediate bloquePLSQL;
end if;
end loop;
end;
and this problem
declare
ERROR en l�nea 1:
ORA-06550: line 64, column 26:
PLS-00201: identifier 'CADENA' must be declared
ORA-06550: line 64, column 13:
PL/SQL: SQL Statement ignored
how must i declare or use CADENA?
thanksI think you wanted to write
select select decode(1,2,'X',rec_test.' || col.column_name || ') into cadena from dual; -
Givin an error-TEMP_REC_CUR' must be declared
declare
v_temp_med_tab temp_med_tab;
cursor tem_rec_cur ---------------HAVE DECLARED A CURSOR HERE
is select * from temp_records_med;
begin
open temp_rec_cur;
fetch temp_rec_cur bulk collect into v_temp_med_tab;
dbms_output.put_line('shikha');
close temp_rec_cur;
end;try to declare variable like below
declare
cursor temp_rec_cur ---------------HAVE DECLARED A CURSOR HERE
is select * from your_table_name;
type temp_med_tab is table of temp_rec_cur%rowtype; -- declare like this
v_temp_med_tab temp_med_tab;
begin
open temp_rec_cur;
fetch temp_rec_cur bulk collect into v_temp_med_tab;
dbms_output.put_line('shikha');
close temp_rec_cur;
end; -
How to return more than one value through RECORD TYPE from function
Hi friends,
i m ew in oracle forms. i want to return the two values at a time from a function but can't,Please help me. my codding is as following
Thanks in advance.
FUNCTION Fun_Choose_Right_cast(v_post_no payroll.post_register.post_no%TYPE) RETURN RECORD IS --here is the error
v_return_char CHAR NOT NULL := 'X';
TYPE row_no_record_type IS RECORD
(v_row_id NUMBER(3)NOT NULL := 0,
v_char CHAR NOT NULL := 'X');
row_no_record row_no_record_type;
BEGIN
IF v_post_no = 1 THEN
IF TRUNC(v_post_no*0.15) >= 1 THEN
row_no_record_type.v_row_id := v_post_no;
v_char := 'A';
--v_return_char := 'A';
END IF;
IF TRUNC(v_post_no*0.075) >= 1 THEN
row_no_record_type.v_row_id := v_post_no;
v_char := 'B';
--v_return_char := 'B';
END IF;
IF TRUNC(v_post_no*0.275) >= 1 THEN
row_no_record_type.v_row_id := v_post_no;
v_char := 'C';
--v_return_char := 'C';
END IF;
IF row_no_record_type.v_row_id = 0 AND v_char = 'X' THEN
row_no_record_type.v_row_id := v_post_no;
v_char := 'D';
--IF v_return_char = 'X' THEN
--v_return_char := 'D';
END IF;
ELSIF(v_post_no BETWEEN 2 AND 100) THEN
IF TRUNC(v_post_no*0.15) > TRUNC((v_post_no-1)*0.15) THEN
row_no_record_type.v_row_id := v_post_no;
v_char := 'A';
--v_return_char := 'A';
END IF;
IF TRUNC(v_post_no*0.075) > TRUNC((v_post_no-1)*0.075) THEN
IF TRUNC(v_post_no*0.15) > TRUNC((v_post_no-1)*0.15) THEN
row_no_record_type.v_row_id := v_post_no-1;
v_char := 'B';
--v_return_char := 'A';
ELSE
row_no_record_type.v_row_id := v_post_no;
v_return_char := 'B';
END IF;
END IF;
IF TRUNC(v_post_no*0.275) > TRUNC((v_post_no-1)*0.275) THEN
row_no_record_type.v_row_id := v_post_no;
v_char := 'C';
--v_return_char := 'C';
END IF;
IF row_no_record_type.v_row_id = 0 AND v_char = 'X' THEN
row_no_record_type.v_row_id := v_post_no;
v_char := 'D';
--IF v_return_char = 'X' THEN
--v_return_char := 'D';
END IF;
END IF;
RETURN row_no_record;
END;Posting your Oracle version is immensely helpful when asking questions (different version = different answers / functionality available).
select * from v$version;Also, using tags will preserve the formatting of your code.
You should likely read (a lot) about [http://www.stanford.edu/dept/itss/docs/oracle/10g/appdev.101/b10807/05_colls.htm]
Basically, you would need to create a PL/SQL record and reference that, OR you could create a SQL type.
If you're looking for a 'simple' way to return many single values (no arrays) then your best bet would be a procedure with multiple OUT parameters. -
How to pass "EnterpriseManagementObject" Type as Function parameter?
Hello, dear Colleagues.
I'm trying to pass "EnterpriseManagementObject" as Function parameter.
Here is the piece of code:
$SCSM = 'SERVER_NAME'
function Add-Comment {
param (
[parameter(Mandatory=$true,Position=0)][Alias('Id')][String]$pSRId,
[parameter(Mandatory=$true,Position=1)][Alias('Comment')][String]$pComment,
[parameter(Mandatory=$true,Position=2)][Alias('EnteredBy')][String]$pEnteredBy,
[parameter(Mandatory=$true,Position=3)][Alias('IsAnalyst')][Bool]$AnalystComment,
[parameter(Mandatory=$true,Position=4)][Alias('IRObject')][EnterpriseManagementObject]$IRObject
if ($IRObject) {
$NewGUID = ([guid]::NewGuid()).ToString()
if ($AnalystComment)
$Projection = @{__CLASS = "System.WorkItem.Incident";
__SEED = $IRObject;
AnalystComments = @{__CLASS = "System.WorkItem.TroubleTicket.AnalystCommentLog";
__OBJECT = @{"Id" = $NewGUID;
Comment = $pComment;
DisplayName = $NewGUID;
EnteredBy = $pEnteredBy;
EnteredDate = (Get-Date).ToUniversalTime();
IsPrivate = $false
New-SCSMObjectProjection -Type System.WorkItem.IncidentPortalProjection -Projection $Projection -ComputerName $SCSM -ErrorAction stop
} else {
Write-Host $pSRId "could not be found"
$IncidentClass = Get-SCSMClass -name System.WorkItem.Incident$ -ComputerName $SCSM
$Incident = Get-SCSMObject -Class $IncidentClass -Filter "name -eq $c" -ComputerName $SCSM
Add-Comment -Id $c -Comment $text -EnteredBy $name -IsAnalyst $False -IRObject $Incident -ErrorAction stop
With GetType() I watched $Incident is "EnterpriseManagementObject":
IsPublic IsSerial Name BaseType
True True EnterpriseManagementObject Microsoft.EnterpriseManagement.Common.EnterpriseManagementObjectBaseWithProperties
But PS script returns error TypeNotFound:
Add-Comment : Unable to find type [EnterpriseManagementObject]. Make sure that the assembly that contains this type is loaded.
At C:\script.ps1:146 char:13
+ Add-Comment -Id $c -Comment $text -EnteredBy $name -IsAnalyst $True ...
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (EnterpriseManagementObject:TypeName) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
Is there a way to pass "EnterpriseManagementObject" as Function parameter?
Thanks.First of all the error indicates that you haven't loaded the assembly which contains the class you're trying to load.
Try loading the assembly by running:
[Reflection.Assembly]::LoadWithPartialName("Microsoft.EnterpriseManagement.Core") | Out-Null
Secondly if you want to use type based parameters restrictions you should use full type name, which can be found with the command:
$SomeObject.GetType().FullName
You should end up with: Microsoft.EnterpriseManagement.Common.EnterpriseManagementObject -
Passing array variables into functions (and why I'm hopeless at arrays)
OK, I have spent a day on this now and have done some fairly
extensive searching online. The problem is - I am hopeless with
arrays (and probably just actionscript generally for that matter)
I want to create an array of buttons, so I set up an array of
actions, step through each item and then try to pass that array
action into an onclick button for an attached button
The problem I have is that the onclick function ALWAYS
returns the last item in the array.
Help!
Code below:
----------------------------------------------------------------the reason for this, is that once the for loop executes, the
'last' value is the only one remaining. what one needs to do here
is 'store' the string in a newly created property on each button,
like this: -
Pass TestStand error type directly into function parameter
Hi,
I am using TestStand 4 and Labwindows CVI 8.5.
I wonder if it is possible to pass Standard Step error type into CVI function parameters.
I think it would be more simple to pass one parameter instead of passing Error code, Error occurred state and Error message into function prototype.
I tried to use tsErrorDataType struct defined into tsutil.h into my function prototype.
In TestStand, I pass Step error type into function parameter but it does not work.
TestStand displays an error meaning parameters does not match function prototype.
Thank you for your help.Hi Tartempion,
In order to pass the TestStand Error Container as one parameter to a function in a CVI DLL, you must use a struct that is typedef'ed and create an .fp file that is included as a type library for the DLL. When you create a .fp file to add to a DLL, the DLL will not build unless all structs/enums are typedef'ed. Thus, I wouldn't advise using the tsutil.h because you would have to go through and typedef every single struct and enum in the header file.
Instead, you can simply create a typedef'ed struct in your projects header file and create an .fp file with the struct specified as a data type. Then in TestStand, when you call the function you would need to ensure that the parameter is of Category "C Struct", and type "Error". The attached zip file contains a CVI 8.5 project that demonstrates this along with a TestStand 4.0 sequence file that demonstrates how to pass the parameter to the function by reference. In case you run into trouble creating the .fp file please refer to the following KnowledgeBase. The instructions are for enums but easily correspond to structs as well:
TestStand and LabWindows/CVI Enumeration Data Types
Hope this helps!
Manooch H.
National Instruments
Attachments:
PassTSError.zip 19 KB
Maybe you are looking for
-
Ok, so the other day I got my phone out of my pocket and I noticed a line near the top edge of my screen. The line is straight, about 15mm long and is parallel to the top edge. I have an Invisible Shield on my phone and I haven't dropped it or anythi
-
Smudge Tool Double Brush Bug Issue
I have a very strange problem that just appeared in my copy of Adobe Photoshop CS5 Version 12.0 x32 Out of nowhere I've noticed that when I use the Smudge Tool my brush will randomly have 2 points instead of one. I've looked all through my brush set
-
Why must this method invocation be caught?!
Hi there. I have this following piece of code: public class Dog extends Animal { public static void main(String[] args) { Animal animal = new Dog(); System.out.println(animal.getAge(args[0])); int getAge(String arg) {
-
Hi Guys, When i am creating invoice document by using VF01, after saving the document it generated the Invoice no and gives the error- Foreign trade data is missing . Its not allowing me to create accounting document. Please help me to solve this iss
-
...