Variable Scope for UPDATES
I am relatively new to Oracle. I have created a package for inserting, listing and updating Contact records.
The package has a procedure "UpdateContact()" that takes multiple values as input params to update the CONTACTS table.
In the SQL that does the update it seems wrong to me to format the line like:
UPDATE Contacts
SET
Column1 = LTRIM(RTRIM(Column1),
Column2 = LTRIM(RTRIM(Column2),
Wrong because there is no distinction (in my mind) between the column name and the varible or param name.
Using MSSQL you define the parameters with the "@" symbol. That way the above statement would be:
UPDATE Contacts
SET
Column1 = LTRIM(RTRIM(@Column1),
Column2 = LTRIM(RTRIM(@Column2),
How is this addressed?
Thanks
Hi Tom,
Thanks for the comment. That is what my intuition told me, although it is not always the case in programming.
If you are using C++ or the like and you declare a record structure, and a procedure that takes a parameter of that type, if you create a new local variable of that type in that procedure, and define or assign it's values from an incoming identical structure of the same name, the local structure will make no distinction there.
Thanks again for the help.
Similar Messages
-
Cursor variable and for update
hi
can anyone explain me why can't we use "for update " with a Cursor Variable.
Thanks in advance.user10314274 wrote:
exmple : I read it in one book(Oracle press)And how difficult is it to test this?
declare
v_cur sys_refcursor;
v_ename varchar2(20);
begin
open v_cur for select ename from emp for update;
loop
fetch v_cur into v_ename;
exit when v_cur%notfound;
dbms_output.put_line(v_ename);
end loop;
close v_cur;
dbms_output.put_line('----------------------');
open v_cur for 'select ename from emp for update';
loop
fetch v_cur into v_ename;
exit when v_cur%notfound;
dbms_output.put_line(v_ename);
end loop;
close v_cur;
end;
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
JAMES
FORD
MILLER
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
JAMES
FORD
MILLER
PL/SQL procedure successfully completed.
SQL> SY. -
Cfm template updating cfc variable scope
Don't know if anybody's run into this before, but I ran into a strange issue with the variable scope in a cfc. Basically, I have some application settings stored in a database table, and then I have a cfc saved to application scope in which I store the contents of the table in a variable scope query. Within the cfc, I have a getter function that preforms a query of queries to pull the data I need. I then have an admin screen within the application to update the settings.
This is (very generally) what my cfc looks like:
<cfcomponent name="settings.cfc">
<cffunction name="init" returntype="settings">
<cfset setAppSettings() />
<cfreturn this />
</cffunction>
<cffunction name="setAppSettings">
<cfquery name="variables.qrySettings" datasource="#application.dsn#">
SELECT *
FROM SETTINGS
</cfquery>
</cffunction>
<cffunction name="getAppSettings" returntype="query">
<cfargument name="id" />
<cfset var local = structNew() />
<cfquery name="local.qryResult" dbtype="query">
SELECT *
FROM variables.qrySettings
WHERE ID = <cfqueryparam value="#arguments.id#" cfsqltype="cf_sql_numeric" />
</cfquery>
<cfreturn local.qryResult />
</cffunction>
</cfcomponent>
In onApplicationStart in Application.cfc, I have this line:
<cfset
application.objSettings = createObject("component","settings").init() />Sorry, accidentally posted before I was done...
Basically, the problem is that I have an admin screen that updates the settings. I call the getter function in a cfm template, and I save the result to a variable called variables.qrySettings (same name as in the cfc) like this - <cfset variables.qrySettings = application.objSettings.getAppSettings(url.id) />. For some reason, this seems to overwrite variables.qrySettings in the cfc. Any ideas???? -
Hello,
I am receiving ORA-01008, not all variables bound. But I don't know what I am missing. I have defined my data adapter for update as below. When I send the datatable to the update command, da.update(dt);, I get not all variables bound. What am I missing?
Thanks,
Kim
oraCmdUpdate.CommandType = CommandType.Text;
oraCmdUpdate.CommandText = "update assay_label set prefix=:prefix, result_type_id=:result_type_id, suffix=:suffix, result_order=:result_order where assay_label_id=:assay_label_id";
oraCmdUpdate.Connection = frmDashBoard2.GetConnection();
oraCmdUpdate.Parameters.Add(new OracleParameter("ASSAY_ID", OracleType.Int32));
oraCmdUpdate.Parameters[0].Direction = ParameterDirection.Input;
oraCmdUpdate.Parameters[0].SourceVersion = DataRowVersion.Original;
oraCmdUpdate.Parameters.Add(new OracleParameter("ASSAY_LABEL_ID", OracleType.Int32));
oraCmdUpdate.Parameters[1].Direction = ParameterDirection.Input;
oraCmdUpdate.Parameters[1].SourceVersion = DataRowVersion.Original;
oraCmdUpdate.Parameters.Add(new OracleParameter("PREFIX", OracleType.VarChar));
oraCmdUpdate.Parameters[2].Direction = ParameterDirection.Input;
oraCmdUpdate.Parameters.Add(new OracleParameter("RESULT_TYPE_ID", OracleType.Int32));
oraCmdUpdate.Parameters[3].Direction = ParameterDirection.Input;
oraCmdUpdate.Parameters.Add(new OracleParameter(":SUFFIX", OracleType.VarChar));
oraCmdUpdate.Parameters[4].Direction = ParameterDirection.Input;
oraCmdUpdate.Parameters.Add(new OracleParameter("RESULT_ORDER", OracleType.Int32));
oraCmdUpdate.Parameters[5].Direction = ParameterDirection.Input;
da.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("ASSAY_LABEL","assayDs",
new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("ASSAY_ID","assay_id"),
new System.Data.Common.DataColumnMapping("ASSAY_LABEL_ID","assay_label_id"),
new System.Data.Common.DataColumnMapping("PREFIX","prefix"),
new System.Data.Common.DataColumnMapping("RESULT_TYPE_ID","result_type_id"),
new System.Data.Common.DataColumnMapping("SUFFIX", "suffix"),
new System.Data.Common.DataColumnMapping("RESULT_ORDER","result_order")})});
da.UpdateCommand = oraCmdUpdate;Hi Kim,
By default ODP.NET works in "bind by position" mode (BindByName=false). This means that unless you set BindByName=true, the parameters will need to be added to the collection in the "correct" order. (i.e. the order in which the appear in the command text). Taking a quick look at the posted code, it looks like the parameters are being added to the collection an order different from that in the command text...
Hope that helps a bit,
Mark -
Standard Program Name for updating the System-Variables everyday in BACKGRO
Hi All,
Can anybody tell me the Standard Program Name for updating the System-Variables everyday in BACKGROUND job?Hello matt,
I have a program with variant.
This VARIANT input values will store in TVARVC table every day night background job.
i want the program name -
Javascript discussion: Variable scopes and functions
Hi,
I'm wondering how people proceed regarding variable scope, and calling
functions and things. For instance, it's finally sunk in that almost
always a variable should be declared with var to keep it local.
But along similar lines, how should one deal with functions? That is,
should every function be completely self contained -- i.e. must any
variables outside the scope of the function be passed to the function,
and the function may not alter any variables but those that are local to
it? Or is that not necessary to be so strict?
Functions also seem to be limited in that they can only return a single
variable. But what if I want to create a function that alters a bunch of
variables?
So I guess that's two questions:
(1) Should all functions be self-contained?
(2) What if the function needs to return a whole bunch of variables?
Thanks,
ArielAriel:
(Incidentally, I couldn't find any way of marking answers correct when I visited the web forums a few days ago, so I gave up.)
It's there...as long as you're logged in at least, and are the poster of the thread.
What I want is to write code that I can easily come back to a few months later
and make changes/add features -- so it's only me that sees the code, but
after long intervals it can almost be as though someone else has written
it! So I was wondering if I would be doing myself a favour by being more
strict about make functions independent etc. Also, I was noticing that
in the sample scripts that accompany InDesign (written by Olav Kvern?)
the functions seem always to require all variables to be passed to it.
Where it is not impractical to do so, you should make functions independent and reusable. But there are plenty of cases where it is impractical, or at least very annoying to do so.
The sample scripts for InDesign are written to be in parallel between three different languages, and have a certain lowest-common-denominator effect. They also make use of some practices I would consider Not Very Good. I would not recommend them as an example for how to learn to write a large Javascript project.
I'm not 100% sure what you mean by persistent session. Most of my
scripts are run once and then quit. However, some do create a modeless
dialog (ie where you can interface with the UI while running it), which
is the only time I need to use #targetengine.
Any script that specifies a #targetengine other than "main" is in a persistent session. It means that variables (and functions) will persist from script invokation to invokation. If you have two scripts that run in #targetengine session, for instance, because of their user interfaces, they can have conficting global variables. (Some people will suggest you should give each script its own #targetengine. I am not convinced this is a good idea, but my reasons against it are mostly speculation about performance and memory issues, which are things I will later tell you to not worry about.)
But I think you've answered one of my questions when you say that the
thing to avoid is the "v1" scope. Although I don't really see what the
problem is in the context of InDesign scripting (unless someone else is
going to using your script as function in one of theirs). Probably in
Web design it's more of an issue, because a web page could be running
several scripts at the same time?
It's more of an issue in web browsers, certainly (which I have ~no experience writing complex Javascript for, by the way), but it matters in ID, too. See above. It also complicates code reuse across projects.
Regarding functions altering variables: for example, I have a catalog
script. myMasterPage is a variable that keeps track of which masterpage
is being used. A function addPage() will add a page, but will need to
update myMasterPage because many other functions in the script refer to
that. However, addPage() also needs to update the total page count
variable, the database-line-number-index-variable and several others,
which are all used in most other functions. It seems laborious and
unnecessary to pass them all to each function, then have the function
alter them and return an array that would then need to be deciphered and
applied back to the main variables. So in such a case I let the function
alter these "global" (though not v1) variables. You're saying that's okay.
Yes, that is OK. It's not a good idea to call that scope "global," though, since you'll promote confusion. You could call it...outer function scope, maybe? Not sure; that assumes addPage() is nested within some other function whose scope is containing myMasterPage.
It is definitely true that you should not individually pass them to the function and return them as an array and reassign them to the outer function's variables.
I think it is OK for addPage() to change them, yes.
Another approach would be something like:
(function() {
var MPstate = {
totalPages: 0,
dbline: -1
function addPage(state) {
state.totalPages++;
state.dbline=0;
return state;
MPstate = addPage(MPstate);
I don't think this is a particularly good approach, though. It is clunky and also doesn't permit an easy way for addPage() to return success or failure.
Of course it could instead do something like:
return { success: true, state: state };
var returnVal = addPage(MPstate);
if (returnVal.success) { MPstate = returnVal.state; }
but that's not very comforting either. Letting addPage() access it's parent functions variables works much much better, as you surmised.
However, the down-side is that intuitively I feel this makes the script
more "messy" -- less legible and professional. (On the other hand, I
recall reading that passing a lot of variables to functions comes with a
performance penalty.)
I think that as long as you sufficiently clearly comment your code it is fine.
Remember this sort of thing is part-and-parcel for a language that has classes and method functions inside those classes (e.g. Java, Python, ActionScript3, C++, etc.). It's totally reasonable for a class to define a bunch of variables that are scoped to that class and then implement a bunch of methods to modify those class variables. You should not sweat it.
Passing lots of variables to functions does not incur any meaningful performance penalty at the level you should be worrying about. Premature optimization is almost always a bad idea. On the other hand, you should avoid doing so for a different reason -- it is hard to read and confusing to remember when the number of arguments to something is more than three or so. For instance, compare:
addPage("iv", 3, "The rain in spain", 4, loremIpsumText);
addPage({ name: "iv", insertAfter: 3, headingText: "The rain in spain",
numberColumns: 4, bodyText: loremIpsumText});
The latter is more verbose, but immensely more readable. And the order of parameters no longer matters.
You should, in general, use Objects in this way when the number of parameters exceeds about three.
I knew a function could return an array. I'll have to read up on it
returing an object. (I mean, I guess I intuitively knew that too -- I'm
sure I've had functions return textFrames or what-have-you),
Remember that in Javascript, when we say Object we mean something like an associative array or dictionary in other languages. An arbitrary set of name/value pairs. This is confusing because it also means other kinds of objects, like DOM objects (textFrames, etc.), which are technically Javascript Objects too, because everything inherits from Object.prototype. But...that's not what I mean.
So yes, read up on Objects. They are incredibly handy. -
Hi All,
We are on Oracle Applications Rel 11.5.8.
We are trying to update an existing ECO with an ‘UPDATE’ transaction_type using eng_Eco_pub API. Here is the code. We first execute this script with CREATE and ECO is created. However, when we run the same script to UPDATE with transaction_type = ‘UPDATE’, the bill_sequence_id in eng_revised_items is updated to g_miss_num (9.99E125). The API is returning ‘SUCCESS’ and updates the bill_sequence_id to 9.999E125. Not sure what we are missing here. Appreciate any inputs or sample code for UPDATING an already created ECO.
REVISED_ITEM_ID BILL_SEQUENCE_ID CHANGE_NOTICE
11668210 192981011 IK-API0316
REVISED_ITEM_ID BILL_SEQUENCE_ID CHANGE_NOTICE
11668210 9.99E125 IK-API0316
Thank You!
DECLARE
l_eco_name VARCHAR2(10) := 'IK-API0000' ;
l_org_code VARCHAR2(3) := 'GLO';
l_transaction_type VARCHAR2(10) := 'CREATE'; -- or UPDATE for updating the same ECO
l_rev_item_number1 VARCHAR2(20):= '16-2214-01';
l_eff_date DATE := NULL;
v_old_effective_date DATE;
l_new_revised_item_revision VARCHAR2(3) := '-A0';
l_eco_rec Eng_Eco_Pub.Eco_Rec_Type := Eng_Eco_Pub.g_miss_eco_rec;
l_eco_revision_tbl Eng_Eco_Pub.Eco_Revision_Tbl_Type := Eng_Eco_Pub.g_miss_eco_revision_tbl;
l_revised_item_tbl Eng_Eco_Pub.Revised_Item_Tbl_Type ;-- := Eng_Eco_Pub.g_miss_revised_item_tbl;
l_rev_component_tbl Bom_Bo_Pub.Rev_Component_Tbl_Type := Eng_Eco_Pub.g_miss_rev_component_tbl;
l_sub_component_tbl Bom_Bo_Pub.Sub_Component_Tbl_Type := Eng_Eco_Pub.g_miss_sub_component_tbl;
l_ref_designator_tbl Bom_Bo_Pub.Ref_Designator_Tbl_Type := Eng_Eco_Pub.g_miss_ref_designator_tbl;
l_rev_operation_tbl Bom_Rtg_Pub.Rev_Operation_Tbl_Type := Eng_Eco_Pub.g_miss_rev_operation_tbl;
l_rev_op_resource_tbl Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type := Eng_Eco_Pub.g_miss_rev_op_resource_tbl;
l_rev_sub_resource_tbl Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type := Eng_Eco_Pub.g_miss_rev_sub_resource_tbl;
-- API output variables
x_eco_rec Eng_Eco_Pub.Eco_Rec_Type := Eng_Eco_Pub.g_miss_eco_rec;
x_eco_revision_tbl Eng_Eco_Pub.Eco_Revision_Tbl_Type := Eng_Eco_Pub.g_miss_eco_revision_tbl;
x_revised_item_tbl Eng_Eco_Pub.Revised_Item_Tbl_Type ;-- := Eng_Eco_Pub.g_miss_revised_item_tbl;
x_rev_component_tbl Bom_Bo_Pub.Rev_Component_Tbl_Type := Eng_Eco_Pub.g_miss_rev_component_tbl;
x_sub_component_tbl Bom_Bo_Pub.Sub_Component_Tbl_Type := Eng_Eco_Pub.g_miss_sub_component_tbl;
x_ref_designator_tbl Bom_Bo_Pub.Ref_Designator_Tbl_Type := Eng_Eco_Pub.g_miss_ref_designator_tbl;
x_rev_operation_tbl Bom_Rtg_Pub.Rev_Operation_Tbl_Type := Eng_Eco_Pub.g_miss_rev_operation_tbl;
x_rev_op_resource_tbl Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type := Eng_Eco_Pub.g_miss_rev_op_resource_tbl;
x_rev_sub_resource_tbl Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type := Eng_Eco_Pub.g_miss_rev_sub_resource_tbl;
-- Other API variables for return status / error handling / debugging
l_error_table Error_Handler.Error_Tbl_Type;
l_return_status VARCHAR2(1) := NULL;
l_msg_count NUMBER := 0;
l_output_dir VARCHAR2(500) := '/apps/orarpt/SJDEV/utl';
l_debug_filename VARCHAR2(60) := 'test.dbg';
-- WHO columns
l_user_id NUMBER := -1;
l_resp_id NUMBER := -1;
l_application_id NUMBER := -1;
l_row_cnt NUMBER := 1;
l_user_name VARCHAR2(30) := 'CA_ADMIN';
l_resp_name VARCHAR2(30) := 'Engineering';
l_comp_eff_date date := null;
l_disable_date date := null;
BEGIN
-- Get the user_id
SELECT user_id,sysdate + 10,sysdate
INTO l_user_id,l_comp_eff_date,l_eff_date
FROM fnd_user
WHERE user_name = l_user_name;
-- Get the application_id and responsibility_id
SELECT application_id, responsibility_id
INTO l_application_id, l_resp_id
FROM fnd_responsibility_tl
WHERE responsibility_name = l_resp_name;
FND_GLOBAL.APPS_INITIALIZE(l_user_id, l_resp_id, l_application_id); -- Mfg / Mfg & Dist Mgr / INV
dbms_output.put_line('Initialized applications context: '|| l_user_id || ' '|| l_resp_id ||' '|| l_application_id );
dbms_output.put_line('before initialixe');
Error_Handler.Initialize;
l_return_status := NULL;
dbms_output.put_line('after initialixe');
-- FOR UPDATE API to update effectivity date on Revised item.
l_eco_rec.eco_name := l_eco_name;
l_eco_rec.organization_code := l_org_code;
l_eco_rec.change_type_code := 'DESIGN';
l_eco_rec.eco_department_name := NULL;
l_eco_rec.priority_code := NULL; --'Medium';
l_eco_rec.approval_list_name := NULL; --'SU_ONLY';
l_eco_rec.reason_code := NULL;
l_eco_rec.Approval_Status_TYPE := 5 ;-- 'Approved'; -- will default to Not submitted for Approval
l_eco_rec.Status_TYPE := 1; -- 1 to bring in SCHEDULE status
l_eco_rec.description := l_eff_date || ' - ECO - '||l_eco_rec.eco_name ;
l_eco_rec.transaction_type := l_transaction_type;
l_eco_rec.return_status := NULL;
IF l_transaction_type ='CREATE' THEN
l_revised_item_tbl(l_row_cnt).transaction_type := l_transaction_type; -- transaction type : CREATE / UPDATE
l_revised_item_tbl(l_row_cnt).eco_name := l_eco_name;
l_revised_item_tbl(l_row_cnt).organization_code := l_org_code;
l_revised_item_tbl(l_row_cnt).revised_item_name := l_rev_item_number1;
l_revised_item_tbl(l_row_cnt).new_revised_item_revision := '-A0'; -- pass only if the previous unimplemented updating ECO has a new revision
l_revised_item_tbl(l_row_cnt).Updated_Revised_Item_Revision := ''; -- l_new_revised_item_revision;
l_revised_item_tbl(l_row_cnt).start_effective_date := l_eff_date;
l_revised_item_tbl(l_row_cnt).new_effective_date := l_eff_date ; -- l_comp_eff_date;
l_revised_item_tbl(l_row_cnt).alternate_bom_code := null;
l_revised_item_tbl(l_row_cnt).status_type := 1; -- 'Open'
l_revised_item_tbl(l_row_cnt).change_description := l_rev_item_number1 || ' --B0 ECO - '||l_eco_rec.eco_name ;
l_revised_item_tbl(l_row_cnt).disposition_type :=1 ;
l_revised_item_tbl(l_row_cnt).update_wip := 1;--2
l_revised_item_tbl(l_row_cnt).mrp_active := 1;
--l_revised_item_tbl(l_row_cnt).new_item_revision:= '';
l_revised_item_tbl(l_row_cnt).new_routing_revision:= '';
l_revised_item_tbl(l_row_cnt).from_end_item_unit_number:= ''; -- this field is mandatory
l_revised_item_tbl(l_row_cnt).eco_for_production:=2;
l_revised_item_tbl(l_row_cnt).earliest_effective_date := l_eff_date;
l_revised_item_tbl(l_row_cnt).use_up_item_name := l_rev_item_number1; null;
--l_revised_item_tbl(l_row_cnt).use_up_plan_name :=null;
END IF;
IF l_transaction_type = 'UPDATE' THEN
FOR v_component in (SELECT * from eng_revised_items where change_notice = 'IK-API0000') LOOP
l_revised_item_tbl(l_row_cnt).eco_name := l_eco_name;
l_revised_item_tbl(l_row_cnt).organization_code := l_org_code;
l_revised_item_tbl(l_row_cnt).revised_item_name := l_rev_item_number1;
l_revised_item_tbl(l_row_cnt).new_revised_item_revision := '-A0';
l_revised_item_tbl(l_row_cnt).New_Revised_Item_Rev_Desc := '-F0 ik added';
l_revised_item_tbl(l_row_cnt).Updated_Revised_Item_Revision := '-F0';
l_revised_item_tbl(l_row_cnt).Start_Effective_Date := l_eff_date;
l_revised_item_tbl(l_row_cnt).New_Effective_Date := l_eff_date;
l_revised_item_tbl(l_row_cnt).Alternate_Bom_Code := v_component.alternate_bom_designator;
l_revised_item_tbl(l_row_cnt).Status_Type := v_component.status_type;
l_revised_item_tbl(l_row_cnt).Mrp_Active := v_component.Mrp_Active;
l_revised_item_tbl(l_row_cnt).Earliest_Effective_Date := sysdate;
l_revised_item_tbl(l_row_cnt).Requestor := '';
l_revised_item_tbl(l_row_cnt).Use_Up_Plan_Name := v_component.Use_Up_Plan_Name;
l_revised_item_tbl(l_row_cnt).Disposition_Type := v_component.Disposition_Type;
l_revised_item_tbl(l_row_cnt).Update_Wip := v_component.Update_Wip;
l_revised_item_tbl(l_row_cnt).Cancel_Comments := v_component.Cancel_Comments;
l_revised_item_tbl(l_row_cnt).Change_Description := 'TESTING ';
l_revised_item_tbl(l_row_cnt).Attribute_category := v_component.Attribute_category;
l_revised_item_tbl(l_row_cnt).Attribute1 := v_component.Attribute1;
l_revised_item_tbl(l_row_cnt).Attribute2 := v_component.Attribute2;
l_revised_item_tbl(l_row_cnt).Attribute3 := v_component.Attribute3;
l_revised_item_tbl(l_row_cnt).Attribute4 := v_component.Attribute4;
l_revised_item_tbl(l_row_cnt).Attribute5 := v_component.Attribute5;
l_revised_item_tbl(l_row_cnt).Attribute6 := v_component.Attribute6;
l_revised_item_tbl(l_row_cnt).Attribute7 := v_component.Attribute7;
l_revised_item_tbl(l_row_cnt).Attribute8 := v_component.Attribute8;
l_revised_item_tbl(l_row_cnt).Attribute9 := v_component.Attribute9;
l_revised_item_tbl(l_row_cnt).Attribute10 := v_component.Attribute10;
l_revised_item_tbl(l_row_cnt).Attribute11 := v_component.Attribute11;
l_revised_item_tbl(l_row_cnt).Attribute12 := v_component.Attribute12;
l_revised_item_tbl(l_row_cnt).Attribute13 := v_component.Attribute13;
l_revised_item_tbl(l_row_cnt).Attribute14 := v_component.Attribute14;
l_revised_item_tbl(l_row_cnt).Attribute15 := v_component.Attribute15;
l_revised_item_tbl(l_row_cnt).From_End_Item_Unit_Number := v_component.From_End_Item_Unit_Number;
l_revised_item_tbl(l_row_cnt).New_From_End_Item_Unit_Number := '';
l_revised_item_tbl(l_row_cnt).Original_System_Reference :=v_component.Original_System_Reference;
l_revised_item_tbl(l_row_cnt).Return_Status := '';
l_revised_item_tbl(l_row_cnt).Transaction_Type := l_transaction_type;
-- L1, the following is added for ECO enhancement
l_revised_item_tbl(l_row_cnt).From_Work_Order := '';
l_revised_item_tbl(l_row_cnt).To_Work_Order := '';
l_revised_item_tbl(l_row_cnt).From_Cumulative_Quantity := v_component.from_cum_qty;
l_revised_item_tbl(l_row_cnt).Lot_Number := v_component.Lot_Number;
l_revised_item_tbl(l_row_cnt).Completion_Subinventory := v_component.Completion_Subinventory;
l_revised_item_tbl(l_row_cnt).Completion_Location_Name :='';
l_revised_item_tbl(l_row_cnt).Priority := v_component.Priority;
l_revised_item_tbl(l_row_cnt).Ctp_Flag := v_component.Ctp_Flag;
l_revised_item_tbl(l_row_cnt).New_Routing_Revision := v_component.New_Routing_Revision;
l_revised_item_tbl(l_row_cnt).Updated_Routing_Revision := '';
l_revised_item_tbl(l_row_cnt).Routing_Comment := v_component.Routing_Comment;
-- L1, the above is added for ECO enhancement
l_revised_item_tbl(l_row_cnt).Eco_For_Production := v_component.Eco_For_Production;
END LOOP;
END IF;
Eng_Eco_PUB.Process_Eco( p_api_version_number => 1.0
, p_init_msg_list => FALSE
, x_return_status => l_return_status
, x_msg_count => l_msg_count
, p_bo_identifier => 'ECO'
, p_eco_rec => l_eco_rec
, p_eco_revision_tbl => l_eco_revision_tbl
, p_revised_item_tbl => l_revised_item_tbl
, p_rev_component_tbl => l_rev_component_tbl
, p_ref_designator_tbl => l_ref_designator_tbl
, p_sub_component_tbl => l_sub_component_tbl
, p_rev_operation_tbl => l_rev_operation_tbl
, p_rev_op_resource_tbl => l_rev_op_resource_tbl
, p_rev_sub_resource_tbl => l_rev_sub_resource_tbl
, x_eco_rec => x_eco_rec
, x_eco_revision_tbl => x_eco_revision_tbl
, x_revised_item_tbl => x_revised_item_tbl
, x_rev_component_tbl => x_rev_component_tbl
, x_ref_designator_tbl => x_ref_designator_tbl
, x_sub_component_tbl => x_sub_component_tbl
, x_rev_operation_tbl => x_rev_operation_tbl
, x_rev_op_resource_tbl => x_rev_op_resource_tbl
, x_rev_sub_resource_tbl => x_rev_sub_resource_tbl
, p_debug => 'N'
, p_output_dir => l_output_dir
, p_debug_filename => l_debug_filename
dbms_output.put_line('after API call');
DBMS_OUTPUT.PUT_LINE('=======================================================');
DBMS_OUTPUT.PUT_LINE('=======================================================');
DBMS_OUTPUT.PUT_LINE('Return Status: '||l_return_status);
dbms_output.put_line('x_eco_rec.eco_name:'|| x_eco_rec.eco_name );
dbms_output.put_line('x_eco_rec.org_code:'|| x_eco_rec.organization_code);
IF (l_return_status = 'E') THEN
dbms_output.put_line('x_msg_count:' || l_msg_count);
Error_Handler.GET_MESSAGE_LIST(x_message_list => l_error_table);
DBMS_OUTPUT.PUT_LINE('Error Message Count :'||l_error_table.COUNT);
FOR i IN 1..l_error_table.COUNT LOOP
--DBMS_OUTPUT.PUT_LINE(to_char(i)||':'||l_error_table(i).entity_index||':'||l_error_table(i).table_name);
DBMS_OUTPUT.PUT_LINE(to_char(i)||':'||l_error_table(i).entity_index||':');
DBMS_OUTPUT.PUT_LINE(to_char(i)||':'||substr(l_error_table(i).message_text,1,250));
END LOOP;
--ROLLBACK;
ELSE
DBMS_OUTPUT.PUT_LINE('==COMMITING==');
--COMMIT;
END IF;
DBMS_OUTPUT.PUT_LINE('=======================================================');
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Exception Occured :');
DBMS_OUTPUT.PUT_LINE(SQLCODE ||':'||SQLERRM);
DBMS_OUTPUT.PUT_LINE('=======================================================');
RAISE;
END;Hi All,
We are on Oracle Applications Rel 11.5.8.
We are trying to update an existing ECO with an ‘UPDATE’ transaction_type using eng_Eco_pub API. Here is the code. We first execute this script with CREATE and ECO is created. However, when we run the same script to UPDATE with transaction_type = ‘UPDATE’, the bill_sequence_id in eng_revised_items is updated to g_miss_num (9.99E125). The API is returning ‘SUCCESS’ and updates the bill_sequence_id to 9.999E125. Not sure what we are missing here. Appreciate any inputs or sample code for UPDATING an already created ECO.
REVISED_ITEM_ID BILL_SEQUENCE_ID CHANGE_NOTICE
11668210 192981011 IK-API0316
REVISED_ITEM_ID BILL_SEQUENCE_ID CHANGE_NOTICE
11668210 9.99E125 IK-API0316
Thank You!
DECLARE
l_eco_name VARCHAR2(10) := 'IK-API0000' ;
l_org_code VARCHAR2(3) := 'GLO';
l_transaction_type VARCHAR2(10) := 'CREATE'; -- or UPDATE for updating the same ECO
l_rev_item_number1 VARCHAR2(20):= '16-2214-01';
l_eff_date DATE := NULL;
v_old_effective_date DATE;
l_new_revised_item_revision VARCHAR2(3) := '-A0';
l_eco_rec Eng_Eco_Pub.Eco_Rec_Type := Eng_Eco_Pub.g_miss_eco_rec;
l_eco_revision_tbl Eng_Eco_Pub.Eco_Revision_Tbl_Type := Eng_Eco_Pub.g_miss_eco_revision_tbl;
l_revised_item_tbl Eng_Eco_Pub.Revised_Item_Tbl_Type ;-- := Eng_Eco_Pub.g_miss_revised_item_tbl;
l_rev_component_tbl Bom_Bo_Pub.Rev_Component_Tbl_Type := Eng_Eco_Pub.g_miss_rev_component_tbl;
l_sub_component_tbl Bom_Bo_Pub.Sub_Component_Tbl_Type := Eng_Eco_Pub.g_miss_sub_component_tbl;
l_ref_designator_tbl Bom_Bo_Pub.Ref_Designator_Tbl_Type := Eng_Eco_Pub.g_miss_ref_designator_tbl;
l_rev_operation_tbl Bom_Rtg_Pub.Rev_Operation_Tbl_Type := Eng_Eco_Pub.g_miss_rev_operation_tbl;
l_rev_op_resource_tbl Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type := Eng_Eco_Pub.g_miss_rev_op_resource_tbl;
l_rev_sub_resource_tbl Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type := Eng_Eco_Pub.g_miss_rev_sub_resource_tbl;
-- API output variables
x_eco_rec Eng_Eco_Pub.Eco_Rec_Type := Eng_Eco_Pub.g_miss_eco_rec;
x_eco_revision_tbl Eng_Eco_Pub.Eco_Revision_Tbl_Type := Eng_Eco_Pub.g_miss_eco_revision_tbl;
x_revised_item_tbl Eng_Eco_Pub.Revised_Item_Tbl_Type ;-- := Eng_Eco_Pub.g_miss_revised_item_tbl;
x_rev_component_tbl Bom_Bo_Pub.Rev_Component_Tbl_Type := Eng_Eco_Pub.g_miss_rev_component_tbl;
x_sub_component_tbl Bom_Bo_Pub.Sub_Component_Tbl_Type := Eng_Eco_Pub.g_miss_sub_component_tbl;
x_ref_designator_tbl Bom_Bo_Pub.Ref_Designator_Tbl_Type := Eng_Eco_Pub.g_miss_ref_designator_tbl;
x_rev_operation_tbl Bom_Rtg_Pub.Rev_Operation_Tbl_Type := Eng_Eco_Pub.g_miss_rev_operation_tbl;
x_rev_op_resource_tbl Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type := Eng_Eco_Pub.g_miss_rev_op_resource_tbl;
x_rev_sub_resource_tbl Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type := Eng_Eco_Pub.g_miss_rev_sub_resource_tbl;
-- Other API variables for return status / error handling / debugging
l_error_table Error_Handler.Error_Tbl_Type;
l_return_status VARCHAR2(1) := NULL;
l_msg_count NUMBER := 0;
l_output_dir VARCHAR2(500) := '/apps/orarpt/SJDEV/utl';
l_debug_filename VARCHAR2(60) := 'test.dbg';
-- WHO columns
l_user_id NUMBER := -1;
l_resp_id NUMBER := -1;
l_application_id NUMBER := -1;
l_row_cnt NUMBER := 1;
l_user_name VARCHAR2(30) := 'CA_ADMIN';
l_resp_name VARCHAR2(30) := 'Engineering';
l_comp_eff_date date := null;
l_disable_date date := null;
BEGIN
-- Get the user_id
SELECT user_id,sysdate + 10,sysdate
INTO l_user_id,l_comp_eff_date,l_eff_date
FROM fnd_user
WHERE user_name = l_user_name;
-- Get the application_id and responsibility_id
SELECT application_id, responsibility_id
INTO l_application_id, l_resp_id
FROM fnd_responsibility_tl
WHERE responsibility_name = l_resp_name;
FND_GLOBAL.APPS_INITIALIZE(l_user_id, l_resp_id, l_application_id); -- Mfg / Mfg & Dist Mgr / INV
dbms_output.put_line('Initialized applications context: '|| l_user_id || ' '|| l_resp_id ||' '|| l_application_id );
dbms_output.put_line('before initialixe');
Error_Handler.Initialize;
l_return_status := NULL;
dbms_output.put_line('after initialixe');
-- FOR UPDATE API to update effectivity date on Revised item.
l_eco_rec.eco_name := l_eco_name;
l_eco_rec.organization_code := l_org_code;
l_eco_rec.change_type_code := 'DESIGN';
l_eco_rec.eco_department_name := NULL;
l_eco_rec.priority_code := NULL; --'Medium';
l_eco_rec.approval_list_name := NULL; --'SU_ONLY';
l_eco_rec.reason_code := NULL;
l_eco_rec.Approval_Status_TYPE := 5 ;-- 'Approved'; -- will default to Not submitted for Approval
l_eco_rec.Status_TYPE := 1; -- 1 to bring in SCHEDULE status
l_eco_rec.description := l_eff_date || ' - ECO - '||l_eco_rec.eco_name ;
l_eco_rec.transaction_type := l_transaction_type;
l_eco_rec.return_status := NULL;
IF l_transaction_type ='CREATE' THEN
l_revised_item_tbl(l_row_cnt).transaction_type := l_transaction_type; -- transaction type : CREATE / UPDATE
l_revised_item_tbl(l_row_cnt).eco_name := l_eco_name;
l_revised_item_tbl(l_row_cnt).organization_code := l_org_code;
l_revised_item_tbl(l_row_cnt).revised_item_name := l_rev_item_number1;
l_revised_item_tbl(l_row_cnt).new_revised_item_revision := '-A0'; -- pass only if the previous unimplemented updating ECO has a new revision
l_revised_item_tbl(l_row_cnt).Updated_Revised_Item_Revision := ''; -- l_new_revised_item_revision;
l_revised_item_tbl(l_row_cnt).start_effective_date := l_eff_date;
l_revised_item_tbl(l_row_cnt).new_effective_date := l_eff_date ; -- l_comp_eff_date;
l_revised_item_tbl(l_row_cnt).alternate_bom_code := null;
l_revised_item_tbl(l_row_cnt).status_type := 1; -- 'Open'
l_revised_item_tbl(l_row_cnt).change_description := l_rev_item_number1 || ' --B0 ECO - '||l_eco_rec.eco_name ;
l_revised_item_tbl(l_row_cnt).disposition_type :=1 ;
l_revised_item_tbl(l_row_cnt).update_wip := 1;--2
l_revised_item_tbl(l_row_cnt).mrp_active := 1;
--l_revised_item_tbl(l_row_cnt).new_item_revision:= '';
l_revised_item_tbl(l_row_cnt).new_routing_revision:= '';
l_revised_item_tbl(l_row_cnt).from_end_item_unit_number:= ''; -- this field is mandatory
l_revised_item_tbl(l_row_cnt).eco_for_production:=2;
l_revised_item_tbl(l_row_cnt).earliest_effective_date := l_eff_date;
l_revised_item_tbl(l_row_cnt).use_up_item_name := l_rev_item_number1; null;
--l_revised_item_tbl(l_row_cnt).use_up_plan_name :=null;
END IF;
IF l_transaction_type = 'UPDATE' THEN
FOR v_component in (SELECT * from eng_revised_items where change_notice = 'IK-API0000') LOOP
l_revised_item_tbl(l_row_cnt).eco_name := l_eco_name;
l_revised_item_tbl(l_row_cnt).organization_code := l_org_code;
l_revised_item_tbl(l_row_cnt).revised_item_name := l_rev_item_number1;
l_revised_item_tbl(l_row_cnt).new_revised_item_revision := '-A0';
l_revised_item_tbl(l_row_cnt).New_Revised_Item_Rev_Desc := '-F0 ik added';
l_revised_item_tbl(l_row_cnt).Updated_Revised_Item_Revision := '-F0';
l_revised_item_tbl(l_row_cnt).Start_Effective_Date := l_eff_date;
l_revised_item_tbl(l_row_cnt).New_Effective_Date := l_eff_date;
l_revised_item_tbl(l_row_cnt).Alternate_Bom_Code := v_component.alternate_bom_designator;
l_revised_item_tbl(l_row_cnt).Status_Type := v_component.status_type;
l_revised_item_tbl(l_row_cnt).Mrp_Active := v_component.Mrp_Active;
l_revised_item_tbl(l_row_cnt).Earliest_Effective_Date := sysdate;
l_revised_item_tbl(l_row_cnt).Requestor := '';
l_revised_item_tbl(l_row_cnt).Use_Up_Plan_Name := v_component.Use_Up_Plan_Name;
l_revised_item_tbl(l_row_cnt).Disposition_Type := v_component.Disposition_Type;
l_revised_item_tbl(l_row_cnt).Update_Wip := v_component.Update_Wip;
l_revised_item_tbl(l_row_cnt).Cancel_Comments := v_component.Cancel_Comments;
l_revised_item_tbl(l_row_cnt).Change_Description := 'TESTING ';
l_revised_item_tbl(l_row_cnt).Attribute_category := v_component.Attribute_category;
l_revised_item_tbl(l_row_cnt).Attribute1 := v_component.Attribute1;
l_revised_item_tbl(l_row_cnt).Attribute2 := v_component.Attribute2;
l_revised_item_tbl(l_row_cnt).Attribute3 := v_component.Attribute3;
l_revised_item_tbl(l_row_cnt).Attribute4 := v_component.Attribute4;
l_revised_item_tbl(l_row_cnt).Attribute5 := v_component.Attribute5;
l_revised_item_tbl(l_row_cnt).Attribute6 := v_component.Attribute6;
l_revised_item_tbl(l_row_cnt).Attribute7 := v_component.Attribute7;
l_revised_item_tbl(l_row_cnt).Attribute8 := v_component.Attribute8;
l_revised_item_tbl(l_row_cnt).Attribute9 := v_component.Attribute9;
l_revised_item_tbl(l_row_cnt).Attribute10 := v_component.Attribute10;
l_revised_item_tbl(l_row_cnt).Attribute11 := v_component.Attribute11;
l_revised_item_tbl(l_row_cnt).Attribute12 := v_component.Attribute12;
l_revised_item_tbl(l_row_cnt).Attribute13 := v_component.Attribute13;
l_revised_item_tbl(l_row_cnt).Attribute14 := v_component.Attribute14;
l_revised_item_tbl(l_row_cnt).Attribute15 := v_component.Attribute15;
l_revised_item_tbl(l_row_cnt).From_End_Item_Unit_Number := v_component.From_End_Item_Unit_Number;
l_revised_item_tbl(l_row_cnt).New_From_End_Item_Unit_Number := '';
l_revised_item_tbl(l_row_cnt).Original_System_Reference :=v_component.Original_System_Reference;
l_revised_item_tbl(l_row_cnt).Return_Status := '';
l_revised_item_tbl(l_row_cnt).Transaction_Type := l_transaction_type;
-- L1, the following is added for ECO enhancement
l_revised_item_tbl(l_row_cnt).From_Work_Order := '';
l_revised_item_tbl(l_row_cnt).To_Work_Order := '';
l_revised_item_tbl(l_row_cnt).From_Cumulative_Quantity := v_component.from_cum_qty;
l_revised_item_tbl(l_row_cnt).Lot_Number := v_component.Lot_Number;
l_revised_item_tbl(l_row_cnt).Completion_Subinventory := v_component.Completion_Subinventory;
l_revised_item_tbl(l_row_cnt).Completion_Location_Name :='';
l_revised_item_tbl(l_row_cnt).Priority := v_component.Priority;
l_revised_item_tbl(l_row_cnt).Ctp_Flag := v_component.Ctp_Flag;
l_revised_item_tbl(l_row_cnt).New_Routing_Revision := v_component.New_Routing_Revision;
l_revised_item_tbl(l_row_cnt).Updated_Routing_Revision := '';
l_revised_item_tbl(l_row_cnt).Routing_Comment := v_component.Routing_Comment;
-- L1, the above is added for ECO enhancement
l_revised_item_tbl(l_row_cnt).Eco_For_Production := v_component.Eco_For_Production;
END LOOP;
END IF;
Eng_Eco_PUB.Process_Eco( p_api_version_number => 1.0
, p_init_msg_list => FALSE
, x_return_status => l_return_status
, x_msg_count => l_msg_count
, p_bo_identifier => 'ECO'
, p_eco_rec => l_eco_rec
, p_eco_revision_tbl => l_eco_revision_tbl
, p_revised_item_tbl => l_revised_item_tbl
, p_rev_component_tbl => l_rev_component_tbl
, p_ref_designator_tbl => l_ref_designator_tbl
, p_sub_component_tbl => l_sub_component_tbl
, p_rev_operation_tbl => l_rev_operation_tbl
, p_rev_op_resource_tbl => l_rev_op_resource_tbl
, p_rev_sub_resource_tbl => l_rev_sub_resource_tbl
, x_eco_rec => x_eco_rec
, x_eco_revision_tbl => x_eco_revision_tbl
, x_revised_item_tbl => x_revised_item_tbl
, x_rev_component_tbl => x_rev_component_tbl
, x_ref_designator_tbl => x_ref_designator_tbl
, x_sub_component_tbl => x_sub_component_tbl
, x_rev_operation_tbl => x_rev_operation_tbl
, x_rev_op_resource_tbl => x_rev_op_resource_tbl
, x_rev_sub_resource_tbl => x_rev_sub_resource_tbl
, p_debug => 'N'
, p_output_dir => l_output_dir
, p_debug_filename => l_debug_filename
dbms_output.put_line('after API call');
DBMS_OUTPUT.PUT_LINE('=======================================================');
DBMS_OUTPUT.PUT_LINE('=======================================================');
DBMS_OUTPUT.PUT_LINE('Return Status: '||l_return_status);
dbms_output.put_line('x_eco_rec.eco_name:'|| x_eco_rec.eco_name );
dbms_output.put_line('x_eco_rec.org_code:'|| x_eco_rec.organization_code);
IF (l_return_status = 'E') THEN
dbms_output.put_line('x_msg_count:' || l_msg_count);
Error_Handler.GET_MESSAGE_LIST(x_message_list => l_error_table);
DBMS_OUTPUT.PUT_LINE('Error Message Count :'||l_error_table.COUNT);
FOR i IN 1..l_error_table.COUNT LOOP
--DBMS_OUTPUT.PUT_LINE(to_char(i)||':'||l_error_table(i).entity_index||':'||l_error_table(i).table_name);
DBMS_OUTPUT.PUT_LINE(to_char(i)||':'||l_error_table(i).entity_index||':');
DBMS_OUTPUT.PUT_LINE(to_char(i)||':'||substr(l_error_table(i).message_text,1,250));
END LOOP;
--ROLLBACK;
ELSE
DBMS_OUTPUT.PUT_LINE('==COMMITING==');
--COMMIT;
END IF;
DBMS_OUTPUT.PUT_LINE('=======================================================');
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Exception Occured :');
DBMS_OUTPUT.PUT_LINE(SQLCODE ||':'||SQLERRM);
DBMS_OUTPUT.PUT_LINE('=======================================================');
RAISE;
END; -
Changing a variables length for text input in Captivate 6
I am using eLearning CS6 (non-subscription I believe, but no one at my office can confirm) and use a machine where all software is deployed via push from IT. The ability to check for updates has been removed from me.
I need to be able to have users enter data into the course and have it both be forwarded on to our database AND appear in later segments of the course.
I recall being able to update the TEB variable length in previous versions but can not find the option anywhere in CS6. or perhaps I'm imaging it.
I am running version 6.0.1.240 and there is no Format option in my TEB properties. I do not see alignment options, and instead see Characters as a menu above the Shadow & Reflection option.
I do know where to set the value in a text caption box. However, I seem to be limited to entering a single variable in the caption field in order for this to be option. However, there are times where we'd rather have multiple variables strung together on a single line, or a word or two of static text appearing before or after the variable.
If I want to string the user entered data from multiple variables into a single caption box there appears to be no way to change the variable's character length from 15 to a higher value.
Does anyone know of another way to work around this other than through the use of multiple caption boxes?
I've been driving myself a bit batty trying to think of a way around the 1 caption 1 variable limit...
Thanks.
Note: Please don't advise me to upgrade. I've already been told the office will not pay for an update to the software so quickly on the heels of our upgrade from CS 5.5 to CS6 (happened within a 6 month span).15 characters is the default when you insert the variable into a text caption. But you can set this to anything from 1 to about 250...as long as you use the Insert Variable icon in the Properties tab > Format accordion to insert the variable. Look for the field in the dialog that allows you to specify the variable's display length.
-
When will there be fix for AirPrint? Since upgrading to Yosemite I cannot print from my MacBook Air which I use mostly. (I can print from the my old 2005 G5 desktop and iPad2 just fine on the same network.) I could print just fine when I had Mavericks. I have tried EVERYTHING under the sun: resetting print system, deleting and adding the printer, checking for updates, uninstalling and reinstalling printer software and folders, turning off modem, router etc. NOTHING works.
The laptop shows that it is printing but nothing happens. Then it says it cannot locate the printer or there is a broken pipe. But it does tell me that I have a low level in one of the ink cartridges (which is true.)
Help! I have warned everyone I know not to upgrade. Is there a way to go back to Mavericks?
MacBook Air (mid 2012), OS 10.10, HP Officejet 7500aThis is what appeared on Console:
11/12/14 12:42:32.558 PM com.apple.preference.printfax.remoteservice[3099]: <NSViewServiceMarshal: 0x7fa398514bd0> failed to complete rights grant 6B212CA9-7872-4726-BA05-68BD5C994479 due to 3
timestamp: 12:42:32.557 Wednesday 12 November 2014
process/thread/queue: com.apple.preference.printfax.remoteservice (3099) / 0x7fff78cb4300 / com.apple.main-thread
code: line 834 of /SourceCache/ViewBridge/ViewBridge-99/NSViewServiceMarshal.m in -[NSViewServiceMarshal invalidateWindowRights]
#exceptions
11/12/14 12:42:32.598 PM com.apple.xpc.launchd[1]: (com.apple.preference.printfax.remoteservice[3099]) Service exited due to signal: Killed: 9
11/12/14 12:42:37.845 PM com.apple.appkit.xpc.openAndSavePanelService[3298]: assertion failed: 14A389: libxpc.dylib + 97940 [9437C02E-A07B-38C8-91CB-299FAA63083D]: 0x89
11/12/14 12:42:37.879 PM sandboxd[246]: ([3295]) Pages(3295) deny file-read-data /Users/Mom/Downloads/CONM 136 - Study Guide Test 3 (2014).docx
11/12/14 12:42:37.971 PM sandboxd[246]: ([3295]) Pages(3295) deny file-read-data /Users/Mom/Downloads/12%20angry%20men.docx
11/12/14 12:42:38.033 PM sandboxd[246]: ([3295]) Pages(3295) deny file-read-data /Users/Mom/Downloads/Quiz%20#2.docx
11/12/14 12:42:39.712 PM sandboxd[246]: ([3295]) Pages(3295) deny file-read-data /Users/Mom/Downloads/12%20angry%20men.docx
11/12/14 12:42:39.000 PM kernel[0]: Sandbox: Pages(3295) deny file-read-data /Users/Mom/Downloads/Quiz%20#2.docx
11/12/14 12:42:39.748 PM sandboxd[246]: ([3295]) Pages(3295) deny file-read-data /Users/Mom/Downloads/12%20angry%20men.docx
11/12/14 12:42:39.850 PM sandboxd[246]: ([3295]) Pages(3295) deny file-read-data /Users/Mom/Downloads/12%20angry%20men.docx
11/12/14 12:42:39.874 PM sandboxd[246]: ([3295]) Pages(3295) deny file-read-data /Users/Mom/Downloads/Quiz%20#2.docx
11/12/14 12:42:39.945 PM sandboxd[246]: ([3295]) Pages(3295) deny file-read-data /Users/Mom/Downloads/Quiz%20#2.docx
11/12/14 12:42:41.000 PM kernel[0]: Sandbox: storeuid(3051) deny mach-lookup com.apple.dock.server
11/12/14 12:42:48.968 PM WindowServer[132]: WSGetSurfaceInWindow : Invalid surface 702894100 for window 1378
11/12/14 12:42:48.968 PM WindowServer[132]: WSGetSurfaceInWindow : Invalid surface 702894100 for window 1378
11/12/14 12:43:17.000 PM kernel[0]: Sandbox: storeuid(3051) deny mach-lookup com.apple.dock.server
11/12/14 12:43:23.225 PM com.apple.xpc.launchd[1]: (com.apple.quicklook[3316]) Endpoint has been activated through legacy launch(3) APIs. Please switch to XPC or bootstrap_check_in(): com.apple.quicklook
11/12/14 12:43:24.355 PM WindowServer[132]: disable_update_timeout: UI updates were forcibly disabled by application "PrinterProxy" for over 1.00 seconds. Server has re-enabled them.
11/12/14 12:43:24.946 PM WindowServer[132]: common_reenable_update: UI updates were finally reenabled by application "PrinterProxy" after 1.59 seconds (server forcibly re-enabled them after 1.00 seconds)
11/12/14 12:43:34.503 PM mdworker[3319]: code validation failed in the process of getting signing information: Error Domain=NSOSStatusErrorDomain Code=-67062 "The operation couldn’t be completed. (OSStatus error -67062.)"
11/12/14 12:43:34.514 PM mdworker[3320]: code validation failed in the process of getting signing information: Error Domain=NSOSStatusErrorDomain Code=-67062 "The operation couldn’t be completed. (OSStatus error -67062.)"
11/12/14 12:43:34.604 PM mdworker[3318]: code validation failed in the process of getting signing information: Error Domain=NSOSStatusErrorDomain Code=-67062 "The operation couldn’t be completed. (OSStatus error -67062.)"
11/12/14 12:44:38.628 PM sandboxd[246]: ([3051]) storeuid(3051) deny mach-lookup com.apple.dock.server
11/12/14 12:44:41.384 PM locationd[63]: Location icon should now be in state 'Active'
11/12/14 12:44:44.653 PM sandboxd[246]: ([375]) com.apple.metada(375) deny mach-lookup com.apple.cfnetwork.cfnetworkagent
11/12/14 12:44:44.793 PM sandboxd[246]: ([375]) com.apple.metada(375) deny mach-lookup com.apple.cfnetwork.cfnetworkagent
11/12/14 12:44:45.149 PM sandboxd[246]: ([375]) com.apple.metada(375) deny mach-lookup com.apple.cfnetwork.cfnetworkagent
11/12/14 12:44:56.515 PM Console[3327]: Failed to connect (_consoleX) outlet from (NSApplication) to (ConsoleX): missing setter or instance variable
11/12/14 12:44:56.641 PM locationd[63]: Location icon should now be in state 'Inactive'
11/12/14 12:44:56.834 PM sandboxd[246]: ([3051]) storeuid(3051) deny mach-lookup com.apple.dock.server
Not sure what any of this means. -
How to update data when primary key is set through for update cursor
Dear friends,
I have tried to update data in the table through forms using cursor for update and i have given the plsql i have used please help me where i do mistake.
DECLARE CURSOR EMP IS
SELECT EMPNO,EMPNAME,FATHERNAME,COMMUNITY,SEX,BILLUNIT,BIRTHDATE,RLYJOINDATE,RETIREMENTDATE
FROM PRMAEMP WHERE BILLUNIT=:CTRL.BILLUNIT AND SERVICESTATUS='SR'ORDER BY DESIGCODE,SCALECODE
FOR UPDATE;
BEGIN
GO_BLOCK('EMP_DETAILS');
SYNCHRONIZE;
FOR I IN EMP
LOOP
I.BILLUNIT:=:EMP_DETAILS.BILLUNIT;
I.EMPNO:=:EMPNO;
I.EMPNAME:=:EMPNAME;
I.FATHERNAME:=:FATHERNAME;
I.COMMUNITY:=:COMMUNITY;
I.SEX:=:SEX;
I.BIRTHDATE:=:BIRTHDATE;
I.RLYJOINDATE:=:RLYJOINDATE;
I.RETIREMENTDATE:=:RETIREMENTDATE;
DOWN;
END LOOP;
COMMIT;
END;
your help is needed immediatelyDECLARE CURSOR ABC IS
SELECT EMPNO,
EMPNAME,
FATHERNAME,
COMMUNITY,
SEX,
BILLUNIT,
BIRTHDATE,
RLYJOINDATE,
RETIREMENTDATE
FROM PRMAEMP
WHERE BILLUNIT=:CTRL.BILLUNIT
AND SERVICESTATUS='SR'
ORDER BY DESIGCODE,SCALECODE
FOR UPDATE OF COMMUNITY;
V_EMPNO PRMAEMP.EMPNO%TYPE;
V_EMPNAME PRMAEMP.EMPNAME%TYPE;
V_FATHERNAME PRMAEMP.FATHERNAME%TYPE;
V_COMMUNITY PRMAEMP.COMMUNITY%TYPE;
V_SEX PRMAEMP.SEX%TYPE;
V_BILLUNIT PRMAEMP.BILLUNIT%TYPE;
V_BIRTHDATE PRMAEMP.BIRTHDATE%TYPE;
V_RLYJOINDATE PRMAEMP.RLYJOINDATE%TYPE;
V_RETIREMENTDATE PRMAEMP.RETIREMENTDATE%TYPE;
BEGIN
GO_BLOCK('EMP');
SYNCHRONIZE;
OPEN ABC;
LOOP
FETCH ABC INTO .... /*yOU NEED TO MENTION YOUR VARIABLES HERE*/;
UPDATE PRMAEMP
SET BILLUNIT= :EMP.BILLUNIT,
EMPNO= :EMPNO,
EMPNAME= :EMPNAME,
FATHERNAME= :FATHERNAME,
COMMUNITY= :COMMUNITY,
SEX= :SEX,
BIRTHDATE= :BIRTHDATE,
RLYJOINDATE= :RLYJOINDATE,
RETIREMENTDATE= :RETIREMENTDATE
WHERE CURRENT OF ABC;
EXIT WHEN ABC%NOTFOUND;
END LOOP;
CLOSE ABC;
END;
COMMIT;
END;Cheers
Sarma. -
BADI or function module for updating open purchase orders
Hi all,
Does anyone know of a BADI or function module which can be used for updating item prices in open purchase orders?
All helpful answers are highly appreciated!
Regards,
MV1 ) execute this program in se38 .enter the input as transaction code for which you want list of User
Exit.
REPORT z_find_userexit NO STANDARD PAGE HEADING.
*& Enter the transaction code that you want to search through in order
*& to find which Standard SAP® User Exits exists.
*& Tables
TABLES : tstc, "SAP® Transaction Codes
tadir, "Directory of Repository Objects
modsapt, "SAP® Enhancements - Short Texts
modact, "Modifications
trdir, "System table TRDIR
tfdir, "Function Module
enlfdir, "Additional Attributes for Function Modules
tstct. "Transaction Code Texts
*& Variables
DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE.
DATA : field1(30).
DATA : v_devclass LIKE tadir-devclass.
*& Selection Screen Parameters
SELECTION-SCREEN BEGIN OF BLOCK a01 WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP.
PARAMETERS : p_tcode LIKE tstc-tcode OBLIGATORY.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK a01.
*& Start of main program
START-OF-SELECTION.
Validate Transaction Code
SELECT SINGLE * FROM tstc
WHERE tcode EQ p_tcode.
Find Repository Objects for transaction code
IF sy-subrc EQ 0.
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'PROG'
AND obj_name = tstc-pgmna.
MOVE : tadir-devclass TO v_devclass.
IF sy-subrc NE 0.
SELECT SINGLE * FROM trdir
WHERE name = tstc-pgmna.
IF trdir-subc EQ 'F'.
SELECT SINGLE * FROM tfdir
WHERE pname = tstc-pgmna.
SELECT SINGLE * FROM enlfdir
WHERE funcname = tfdir-funcname.
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'FUGR'
AND obj_name = enlfdir-area.
MOVE : tadir-devclass TO v_devclass.
ENDIF.
ENDIF.
Find SAP® Modifications
SELECT * FROM tadir
INTO TABLE jtab
WHERE pgmid = 'R3TR'
AND object = 'SMOD'
AND devclass = v_devclass.
SELECT SINGLE * FROM tstct
WHERE sprsl EQ sy-langu
AND tcode EQ p_tcode.
FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
WRITE:/(19) 'Transaction Code - ',
20(20) p_tcode,
45(50) tstct-ttext.
SKIP.
IF NOT jtab[] IS INITIAL.
WRITE:/(95) sy-uline.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/1 sy-vline,
2 'Exit Name',
21 sy-vline ,
22 'Description',
95 sy-vline.
WRITE:/(95) sy-uline.
LOOP AT jtab.
SELECT SINGLE * FROM modsapt
WHERE sprsl = sy-langu AND
name = jtab-obj_name.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
WRITE:/1 sy-vline,
2 jtab-obj_name HOTSPOT ON,
21 sy-vline ,
22 modsapt-modtext,
95 sy-vline.
ENDLOOP.
WRITE:/(95) sy-uline.
DESCRIBE TABLE jtab.
SKIP.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/ 'No of Exits:' , sy-tfill.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(95) 'No User Exit exists'.
ENDIF.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(95) 'Transaction Code Does Not Exist'.
ENDIF.
Take the user to SMOD for the Exit that was selected.
AT LINE-SELECTION.
GET CURSOR FIELD field1.
CHECK field1(4) EQ 'JTAB'.
SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).
CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
2) Second way is to go to transaction code SE93 .enter transaction code click on display.
There you will see the package. Copy that package name.
Go to transaction code se84
Enhancements -customer exits-enhancementsu2014enter package there and execute.
You will get list of exits.
3) BAPI for PO change is
BAPI_PO_CHANGE -
Shared variable no longer updates
All,
I have an RT Systems 2011 and have been using shared variables between the RT and Host. Working for months. Then I renamed a shared variable and it no longer updates. When I try to look at the variable in the NI Distributed System Manager, it reports that it does not exist.
I changed the name back to what it was, it is seen by the System Manager but the current value is not displayed.
I did a remote debug into the RT code and the variable is being updated.
Any ideas\comments\etc would be appreciated?
ThanksWhat hardware are you using as your real-time target? When you mentioned that you are using "RT Systems 2011", are you using LabVIEW 2011 and the Real-Time Module?
After you updated the shared variable, did you re-deploy it? I highly recommend reading through the “Deployment and Hosting” section of the DeveloperZone Tutorial linked below:
http://www.ni.com/white-paper/4679/en/#toc3
Regards,
Cameron F
Applications Engineer
National Instruments -
API/package/procedure/function for updating physical attributes in Org/Mast
I need some kind of procedure or function for updating the weight, volume, and dimensions in the organization and master items forms. We have almost 350,000 items and I want to update them in batch. Is there an API of some kind for this? I would do a simple update but I want to make sure there's no additional logic necessary (other tables that are updated during the process of updating those fields, etc).
Thanks!here is for API's you need to check...
You can use Decimal & UOM Quantity API
These APIs are used to handle item decimal quantities:
Convert from one UOM to another
Validate quantities at input time
Validate quantities at display/output time
Quantity Comparison
Get UOM information
For your convenience, I am giving you the API as below:
/*===========================================================================+
| Copyright (c) 1999 Oracle Corporation |
| Redwood Shores, California, USA |
| All rights reserved. |
+===========================================================================*/
/*-----------------------------------------------------------------------+
|This package contains procedures relevent to item decimal quantity |
|processing. This package contains routines to: |
|(1)validate item quantities based on UOM and decimal precision rules |
|(2)validate whether the UOM controls and decimal precision rules |
| themselves are correct based on functionality planned. For reviewing|
| UOM and decimal quantity functional design details, please visit the|
| following URL: |
| "http//apps-us.oracle.com/inv/development/designs_120/ |
| decimal_precision/decimal_precision.html" |
|But here are a few basics to give background context: |
| |
| "Item Quantity" -- The item's quantity is described by the item |
| identifier, the unit of measure (e.g. grams, kilos, etc), and a |
| number value to indicate the amount in that unit of measure. |
| |
| "Unit of Measure" -- Units of measure belong to unit of measure |
| classes(e.g. weight, volume, length, etc). Each unit of measure class|
| has actual units of measure that belong to that class (e.g. the |
| weight class may have units of measures like, "grams", "kilos", etc).|
| |
| "UOM Conversion" --Users can set up conversion rates between UOMs in |
| them same UOM class, by defining conversions to the base UOM. These |
| are standard conversions. Item-level intra-class conversions may also|
| be defined. When doing intra-class conversions, item-level |
| intra-class conversions are used first if defined, and then standard |
| conversions are used. |
| Users can define inter-class conversions. Inter-class Conversions may|
| also be defined at the lot/sublot levels. For inter-class conversions|
| sublot, lot, and then item inter-class conversions will be used in |
| in order. If lot-lvel conversion is not defined, then item-level |
| conversion is used. A strict hierarchy is imposed. |
| |
| "TU" -- Trasactable Unit.A UOM may have a TU. This implies |
| that when transacting in this UOM, any item's quantities will be |
| forced to be integer multiples of this TU quantity. The TU may also |
| be declared at the item level. The TU quantity at the item level may |
| be different from the UOM level TU, and if defined, item level TU |
| takes precedance. |
| |
| "Decimal Precision"--Users have a choice of setting decimal precision|
| at the base UOM for each UOM class. All other UOMs in that class get |
| get their decimal precisions derived from the base UOM decimal |
| precision, the converison rate, and TUs, if they are |
| being used. |
| |
| |
| "Conversion Rate Tolerance" -- This is a tolerance that may be set |
| when conversion rate cannot be not strictly fixed. Example: |
| 1 Chicken = 2 pounds (plus or minus 0.7 pounds). This 0.7 pounds is |
| the conversion rate tolerance. Conversion rate tolerance is only |
| definable at inter-class UOM conversions, at item or lot/sublot level|
| |
| History |
| 04/08/99 Mansoor Jafri Created Package Spec |
| 04/26/99 Mansoor Jafri Updated with TU at 3 levels as |
| opposed to MTU at 2 and atomic at|
| UOM class level. |
| 04/29/99 Mansoor Jafri Updated document with lot/sublot |
| conversions. Also, removed |
| "atomic" as a separate control, |
| since this can |
| implemented as a TU at base UOM |
| level with an integer quantity. |
| 05/03/99 Mansoor Jafri Updated the package with sublot |
| level control. Also, changed name|
| of DTU to TU, so that it fits |
| better in the "process" market. |
| Also, conformed to BOI API stds. |
+-----------------------------------------------------------------------*/
SET VERIFY OFF
WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
CREATE OR REPLACE PACKAGE inv_decimals_pub AS
/* $Header: INVDECPS.pls 118.3 99/05/03 18:12:27 mjafri noship $ */
/*--------------------------------------------------------------------------+
|Procedure validate_compare_quantities(..)
|Returns the quantity converted from the first UOM in the second UOM.
|If quantities in 2 UOMs are already available, then this procedure will
|compare and validate these quantities based on conversion rates
|and UOM and decimal qty controls. This procedure may be used to validate
|scenarios where quatities are entered in dual UOMs. We want to make sure
|quantities are valid based on conversion, TUs, and conversion
|rate tolerances.
|
|Procedure validate_and_compare(
|p_api_version_number IN NUMBER, -- version # of API
|p_init_msg_list IN VARCHAR2, -- whether to initialize list
|p_inventory_item_id IN NUMBER, -- inventory_item_id
|p_organization_id IN NUMBER, -- organization_id
|p_lot_control_code IN NUMBER, -- item's lot control code
|p_lot_number IN VARCHAR2, -- lot number
|p_sub_lot_control_code IN NUMBER, --sub lot control code
|p_sublot_number IN VARCHAR2, -- sublot number
|p_from_quantity IN NUMBER, -- qty in first UOM
|p_from_uom_code IN VARCHAR2, -- UOM of fisrt qty
|p_to_uom_code IN VARCHAR2, -- UOM of second qty
|p_to_quantity_to_check IN NUMBER, -- qty in second UOM
|x_resultant_to_quantity OUT NUMBER, -- calculated qty in second UOM
|x_comparison OUT NUMBER,--Possible values are 1,0,-1,-99
|x_msg_count OUT NUMBER, -- number of messages
|x_msg_data OUT VARCHAR2, -- populated,if msg count = 1
|x_return_status OUT VARCHAR2) -- return status
|
|Note: The comparisons are done in base UOM
| of the UOM class to which the first UOM belongs. x_comparison returns:
|-1 if from_quantity is less than to_quantity (A < B)
| 0 if from_quantity is equal to to_quantity (A = B)
| 1 if from_quantity is greater than to_quantity (A > B)
| -99 if the validations for the first/second quantity failed
| If the UOMs belong to different classes, then users can specify whether
| they want to use the effective interclass UOM conversion tolerance, say, T.
| CASE: p_use_interclass_tolerance = 1
| ------
| Q1 > Q2 if (Q1 - Q2) >= T
| Q1 = Q2 if ABS(Q1 - Q2) < T
| Q1 < Q2 if (Q1 - Q2 ) <= -T
|
|The output variable x_resultant_to_quantity will contain the converted
|quantity
|in the second UOM, using effective conversion rates.
|Usage: In a dual UOM scenario, this api will confirm whether quantities in
|the two UOMs are equal or not, based on x_comparison output variable.
+--------------------------------------------------------------------------*/
Procedure validate_compare_quantities(
p_api_version_number IN NUMBER,
p_init_msg_list IN VARCHAR2,
p_inventory_item_id IN NUMBER,
p_organization_id IN NUMBER,
p_lot_control_code IN NUMBER,
p_lot_number IN VARCHAR2,
p_sub_lot_control_code IN NUMBER,
p_sublot_number IN VARCHAR2,
p_from_quantity IN NUMBER,
p_from_uom_code IN VARCHAR2,
p_to_uom_code IN VARCHAR2,
p_to_quantity_to_check IN NUMBER,
x_resultant_to_quantity OUT NUMBER,
x_valid_conversion OUT NUMBER,
x_msg_count OUT NUMBER,
x_msg_data OUT VARCHAR2,
x_return_status OUT VARCHAR2);
/*--------------------------------------------------------------------------+
|Function convert_UOM(..) return NUMBER ;
|Returns the quantity converted from the first unit into the second unit.
|If conversion is not possible, return status is failure.
|Function convert(
|p_api_version_number IN NUMBER,
|p_init_msg_list IN VARCHAR2, -- whether to initialize list
|p_inventory_item_id IN NUMBER, -- inventory_item_id
|p_organization_id IN NUMBER, -- organization_id
|p_lot_control_code IN NUMBER, -- item's lot control code
|p_lot_number IN VARCHAR2, -- lot number
|p_sub_lot_control_code IN NUMBER,
|p_sublot_number IN VARCHAR2,
|p_from_quantity IN NUMBER, -- qty in first UOM
|p_from_uom_code IN VARCHAR2, -- UOM of fisrt qty
|p_to_uom_code IN VARCHAR2, -- UOM of second qty
|x_msg_count OUT NUMBER,
|x_msg_data OUT VARCHAR2,
|x_return_status OUT VARCHAR2)
| return NUMBER ;
|If there is an error, then -99 is returned.
|1) From_quantity must be an absolute value.
|2) From_quantity will be truncated to decimal precision in the from UOM, then
| converted to base UOM in the class,
|3) Then converted to base UOM of the
| to_UOM class,
|4) Then converted to the quantity in to_UOM,
|5) Then truncated to decimal precision of the to_UOM.
+--------------------------------------------------------------------------*/
Function convert_UOM(
p_api_version_number IN NUMBER,
p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
p_inventory_item_id IN NUMBER,
p_organization_id IN NUMBER,
p_lot_control_code IN NUMBER,
p_lot_number IN VARCHAR2,
p_sub_lot_control_code IN NUMBER,
p_sublot_number IN VARCHAR2,
p_from_quantity IN NUMBER,
p_from_uom_code IN VARCHAR2,
p_to_uom_code IN VARCHAR2,
x_msg_count OUT NUMBER,
x_msg_data OUT VARCHAR2,
x_return_status OUT VARCHAR2) return NUMBER ;
/*--------------------------------------------------------------------------+
| get_uom_properties(..)
| This procedure is used to interrogate the UOM.
| It returns:
| (1) decimal precision at the UOM level
| (2) TU, if defined, at the UOM level
| (3) Atomicity, if defined for the class that this UOM belongs to
| If some of the controls are not defined, null values are returned.
| if the UOM is not found, the return status indicates this.
| Procedure get_uom_properties(
| p_api_version_number IN NUMBER,
| p_init_msg_list IN VARCHAR2,
| p_uom_code IN VARCHAR2,
| x_decimal_precision OUT NUMBER,
| x_uom_TU OUT NUMBER,
| x_uom_class OUT VARCHAR2,
| x_msg_count OUT NUMBER,
| x_msg_data OUT VARCHAR2,
| x_return_status OUT VARCAHR2);
+--------------------------------------------------------------------------*/
Procedure get_uom_properties(
p_api_version_number IN NUMBER,
p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
p_uom_code IN VARCHAR2,
x_decimal_precision OUT NUMBER,
x_uom_TU OUT NUMBER,
x_uom_class OUT VARCHAR2,
x_msg_count OUT NUMBER,
x_msg_data OUT VARCHAR2,
x_return_status OUT VARCAHR2);
/*-------------------------------------------------------------------------+
| get_item_uom_properties(..)
| This procedure returns a specific item's primary UOM, TU, and tolerance
| Procedure get_item_uom_properties(
| p_api_version_number IN NUMBER,
| p_init_msg_list IN VARCHAR2,
| p_inventory_item_id IN NUMBER,
| p_organization_id IN NUMBER,
| p_lot_control_code IN NUMBER, -- item's lot control code
| p_lot_number IN VARCHAR2,
| p_sub_lot_control_code IN NUMBER,
| p_sublot_number IN VARCHAR2,
| x_primary_uom_code OUT VARCHAR2,
| x_uom_class OUT VARCHAR2,
| x_decimal_precision OUT NUMBER,
| x_item_TU OUT NUMBER,
| x_uom_TU OUT NUMBER,
| x_effective_TU OUT NUMBER,
| x_msg_count OUT NUMBER,
| x_msg_data OUT VARCHAR2,
| x_return_status OUT VARCHAR2 );
| If the item is not a valid one, then this is reflected through the
| return status.
+-------------------------------------------------------------------------*/
Procedure get_item_uom_properties(
p_api_version_number IN NUMBER,
p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
p_inventory_item_id IN NUMBER,
p_organization_id IN NUMBER,
p_lot_control_code IN NUMBER,
p_lot_number IN VARCHAR2,
p_sub_lot_control_code IN NUMBER,
p_sublot_number IN VARCHAR2,
x_primary_uom_code OUT VARCHAR2,
x_uom_class OUT VARCHAR2,
x_decimal_precision OUT NUMBER,
x_item_TU OUT NUMBER,
x_class_TU OUT NUMBER,
x_uom_TU OUT NUMBER,
x_effective_TU OUT NUMBER,
x_msg_count OUT NUMBER,
x_msg_data OUT VARCHAR2,
x_return_status OUT VARCHAR2 );
/*-------------------------------------------------------------------------+
| Procedure compare_quantities(..)
| Procedure compare_quantities(
| p_api_version_number IN NUMBER,
| p_init_msg_list IN VARCHAR2,
| p_inventory_item_id IN NUMBER,
| p_organization_id IN NUMBER,
| p_lot_control_code IN NUMBER,
| p_lot_number IN VARCHAR2,
| p_sub_lot_control_code IN NUMBER,
| p_sublot_number IN VARCHAR2,
| p_fisrt_qauantity IN NUMBER,
| p_first_uom IN VARCHAR2,
| p_second_quantity IN NUMBER,
| p_second_uom IN VARCHAR2,
| p_use_interclass_tolerance IN VARCHAR2, -- Yes = 1, 2 = No
| x_comaprison_result OUT NUMBER,
| x_msg_count OUT NUMBER,
| x_msg_data OUT VARCHAR2,
| x_return_status OUT VARCHAR2);
|
| This procedure compares the quantities A and B and returns result in the
| output variable x_comparison_result. The comparisons are done in base UOM
| of the UOM class to which the first UOM belongs:
|-1 if quantity A is less than quantity B (A < B)
| 0 if quantity A is equal to quantity B (A = B)
| 1 if quantity A is greater than quantity B (A > B)
| If the UOMs belong to different classes, then users can specify whether
| they want to use interclass UOM conversion tolerance, say, T.
| CASE: p_use_interclass_tolerance = 1
| ------
| Q1 > Q2 if (Q1 - Q2) >= T
| Q1 = Q2 if ABS(Q1 - Q2) < T
| Q1 < Q2 if (Q1 - Q2 ) <= -T
+------------------------------------------------------------------------*/
Procedure compare_quantities(
p_api_version_number IN NUMBER,
p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
p_inventory_item_id IN NUMBER,
p_organization_id IN NUMBER,
p_lot_control_code IN NUMBER,
p_lot_number IN VARCAHR2,
p_sub_lot_control_code IN NUMBER,
p_sublot_number IN VARCHAR2,
p_fisrt_qauantity IN NUMBER,
p_first_uom IN VARCHAR2,
p_second_quantity IN NUMBER,
p_second_uom IN VARCHAR2,
p_use_interclass_tolerance IN VARCHAR2,
x_comaprison_result OUT NUMBER,
x_msg_count OUT NUMBER,
x_msg_data OUT VARCHAR2,
x_return_status OUT VARCHAR2);
/*-----------------------------------------------------------------------+
| Procedure Validate_Quantity(
| p_api_version_number IN NUMBER,
| p_init_msg_list IN VARCHAR2,
| p_inventory_item_id IN NUMBER,
| p_organization_id IN NUMBER,
| p_lot_control_code IN NUMBER,
| p_lot_number IN VARCHAR2,
| p_sub_lot_control_code IN NUMBER,
| p_sublot_number IN VARCHAR2,
| p_input_quantity IN NUMBER,
| p_UOM_code IN VARCHAR2,
| x_msg_count OUT NUMBER,
| x_msg_data OUT VARCHAR2,
| x_return_status OUT VARCHAR2);
|
| Validates and returns the quantity in this manner (the caller does not need
| to adjust the result):
| 0. Truncate to and validate decimal precision
| 1. Validate quantity with respect to TU controls.
+-------------------------------------------------------------------------*/
Procedure Validate_Quantity(
p_api_version_number IN NUMBER,
p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
p_inventory_item_id IN NUMBER,
p_organization_id IN NUMBER,
p_lot_control_code IN NUMBER,
p_lot_number IN VARCAHR2,
p_sub_lot_control_code IN NUMBER,
p_sublot_number IN VARCHAR2,
p_input_quantity IN NUMBER,
p_UOM_code IN VARCHAR2,
x_msg_count OUT NUMBER,
x_msg_data OUT VARCHAR2,
x_return_status OUT VARCHAR2);
/*------------------------------------------------------------------------+
| Function Truncate_Quantity(
| p_api_version_number IN NUMBER,
| p_init_msg_list IN VARCHAR2,
| p_inventory_item_id IN NUMBER,
| p_organization_id IN NUMBER,
| p_lot_control_code IN NUMBER,
| p_lot_number IN VARCHAR2,
| p_sub_lot_control_code IN NUMBER,
| p_sublot_number IN VARCHAR2,
| p_input_quantity IN NUMBER,
| p_UOM_code IN VARCHAR2,
| x_msg_count OUT NUMBER,
| x_msg_data OUT VARCHAR2,
| x_return_status OUT VARCHAR2) return NUMBER;
|
| Truncates the quantity to decimal precision of the UOM.
| In case of error conditions, -99 is returned.
+------------------------------------------------------------------------*/
Function Truncate_Quantity(
p_api_version_number IN NUMBER,
p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
p_inventory_item_id IN NUMBER,
p_organization_id IN NUMBER,
p_lot_control_code IN NUMBER,
p_lot_number IN VARCHAR2,
p_sub_lot_control_code IN NUMBER,
p_sublot_number IN VARCHAR2,
p_input_quantity IN NUMBER,
p_UOM_code IN VARCHAR2,
x_msg_count OUT NUMBER,
x_msg_data OUT VARCHAR2,
x_return_status OUT VARCHAR2) return NUMBER;
* show errors package INV_DECIMALS_PUB
* SELECT to_date('SQLERROR') FROM user_errors
* WHERE name = 'INV_DECIMALS_PUB'
* AND type = 'PACKAGE';
commit;
exit; -
How to select a random row with for update?
Hi,
I have a package that needs to assign a random, reusable number (ID) that is not currently being used - to a procedure.
I'm trying to simulate a pool of numbers (IDs) using a table that has an ID and IS_USED columns.
How do I do:
select a random ID (random row)
from pool_table
where IS_USED is 0 (not taken)
FOR UPDATEThe for update is to lock the row from being taken by another process calling the package.
OR:
Can I simulate a pool of numbers with a different object (not a table)?
I need the numbers to be coherent between sessions (thus package variables will not work) and only one session uses the same ID at any given time. When it finishes the number becomes available for further runs.
Thanks.
Edited by: Pyrocks on Nov 7, 2010 10:45 AMThis works on Oracle 11g (probably on 10g too, but I haven't tested):
CREATE OR REPLACE PACKAGE REUSABLE_RANDOM_NUMBERS
IS
FUNCTION GET_NUMBER RETURN NUMBER;
END REUSABLE_RANDOM_NUMBERS;
create or replace
PACKAGE BODY REUSABLE_RANDOM_NUMBERS
IS
TYPE NUM_TABLE_TYPE IS TABLE OF CHAR INDEX BY PLS_INTEGER;
MIN_VALUE CONSTANT PLS_INTEGER := 0;
max_value CONSTANT PLS_INTEGER := 10;
NUM_TABLE NUM_TABLE_TYPE;
FUNCTION GET_NUMBER RETURN NUMBER
IS
num PLS_INTEGER;
BEGIN
FOR I IN 1 .. 100 LOOP
NUM := DBMS_RANDOM.VALUE( min_value, max_value );
IF NOT NUM_TABLE.EXISTS( NUM ) THEN
NUM_TABLE( NUM ) := 'X';
RETURN NUM;
END IF;
END LOOP;
FOR I IN MIN_VALUE .. MAX_VALUE LOOP
IF NOT NUM_TABLE.EXISTS( i ) THEN
NUM_TABLE( i ) := 'X';
RETURN i;
END IF;
END LOOP;
RAISE_APPLICATION_ERROR( -20991, 'All possible values have ben used, cannot assign a new one' );
END;
END REUSABLE_RANDOM_NUMBERS;
SELECT REUSABLE_RANDOM_NUMBERS.GET_NUMBER
FROM DUAL
connect by level <= 11;
GET_NUMBER
3
4
6
2
1
7
8
0
9
5
10
11 rows selected
SELECT REUSABLE_RANDOM_NUMBERS.GET_NUMBER
FROM DUAL;
Error starting at line 44 in command:
SELECT REUSABLE_RANDOM_NUMBERS.GET_NUMBER
FROM DUAL
Error report:
SQL Error: ORA-20991: All possible values have ben used, cannot assign a new one
ORA-06512: przy "TEST.REUSABLE_RANDOM_NUMBERS", linia 26 -
Deadlock detected during SELECT FOR UPDATE - an application error?
I have a general question about how Oracle prevents deadlocks from affecting
applications: do I need to build support into the application for handling
deadlocks when they occur in this particular scenario, or should Oracle handle
this for me? I'd like to know whether this is "normal" behavior for an Oracle
application, or if there is an underlying problem. Consider the following situation:
Two sessions issue individual SELECT FOR UPDATE queries. Each query locates
records in the table using a different index. These indexes point to rows in a
different order from each other, meaning that a deadlock will occur if the two
statement execute simultaneously.
For illustrative purposes, consider these rows in a hypothetical table.
ALPHABET
alpha
bravo
charlie
delta
echo
foxtrot
golf
hotel
Index A results in traversing the table in ascending alphabetical order; index
B, descending. If two SELECT FOR UPDATE statements concurrently execute on this
table--one with an ascending order execution path and one in descending order--
the two processes will deadlock at the point where they meet. If Session A
locks alpha, bravo, charlie, and delta, while Session B locks hotel, golf,
foxtrot, and echo, then neither process can proceed. A needs to lock echo, and
B needs to lock delta, but one cannot continue until the other releases its
locks.
This execution path can be encouraged using hints. Executing queries similar to these on larger tables will generate the "collision" as described above.
-- Session A
select /*+ index_asc (customer) */
from customer
where gender = 'M'
for update;
-- Session B
select /*+ index_desc (customer) */
from customer
where gender = 'M'
for update;
Oracle will recognize that both sessions are in a stand-off, and it will roll
back the work performed by one of the two sessions to break the deadlock.
My question pivots on whether or not, in this situation, the deadlock gets
reported back to the application executing the queries as an ORA-00060. If
these are the ONLY queries executed during these sessions, I would think that
Oracle would rollback the locking performed in one of the SELECT FOR UPDATE
statements. If I understand correctly,
(1) Oracle silently rolls back and replays work performed by UPDATE statements
when a deadlock situation occurs within the scope of the update statement,
and
(2) A SELECT FOR UPDATE statement causes Oracle, at the point in time the cursor
is opened, to lock all rows matching the WHERE clause.
If this is the case, then should I expect Oracle to produce an ORA-00060
deadlock detection error for two SELECT FOR UPDATE statements?
I would think that, for deadlock situations completely within Oracle's control,
this should be perceived to the application invoking the SELECT FOR UPDATE
statements as regular blocking. Since the query execution plans are the sole
reason for this deadlock situation, I think that Oracle would handle the
situation gracefully (like it does for UPDATE, as referenced in (1)).
Notice, from the trace file below, that the waits appear to be from row locking,
and not from an artificial deadlock (e.g. ITL contention).
Oracle8i Enterprise Edition Release 8.1.7.4.0 - 64bit Production
With the Partitioning option
DEADLOCK DETECTED
Current SQL statement for this session:
SELECT XXX FROM YYY WHERE ZZZ LIKE 'AAA%' FOR UPDATE
----- PL/SQL Call Stack -----
object line object
handle number name
58a1f8f18 4 anonymous block
58a1f8f18 11 anonymous block
The following deadlock is not an ORACLE error. It is a
deadlock due to user error in the design of an application
or from issuing incorrect ad-hoc SQL. The following
information may aid in determining the deadlock:
Deadlock graph:
---------Blocker(s)-------- ---------Waiter(s)---------
Resource Name process session holds waits process session holds waits
TX-002f004b-000412cf 37 26 X 26 44 X
TX-002e0044-000638b7 26 44 X 37 26 X
session 26: DID 0001-0025-00000002 session 44: DID 0001-001A-00000002
session 44: DID 0001-001A-00000002 session 26: DID 0001-0025-00000002
Rows waited on:
Session 44: obj - rowid = 0000CE31 - AAANCFAApAAAAGBAAX
Session 26: obj - rowid = 0000CE33 - AAANCHAArAAAAOmAAM
Thanks for your insight,
- Curtis
(1) "Oracle will silently roll back your update and restart it"
http://tkyte.blogspot.com/2005/08/something-different-part-i-of-iii.html
(2) "All rows are locked when you open the cursor, not as they are fetched."
http://download-east.oracle.com/docs/cd/A87860_01/doc/appdev.817/a77069/05_ora.htm#2170
Message was edited by:
Curtis LightThanks for your response. In my example, I used the indexes to force a pair of query execution plans to "collide" somewhere in the table in question by having one query traverse the table via index in an ascending order, and another in descending. This is an artificial scenario for reproducible illustrative purposes, but similar collisions could legitimately occur in real world scenarios (e.g. a full table scan and an index range scan with lookup by ROWID).
So, with that said, I think it would be unreasonable for Oracle to report the collision as a ORA-00060 every time it occurs because:
(1) The UPDATE statement handles this situation automatically, and
(2) An ORA-00060 results in a 100+KB trace file being written out, only rational for truly erroneous situations.
I agree that, when the application misbehaves and locks rows out of order in separate SQL statements, then Oracle should raise an ORA-00060, as the deadlock is outside of its control. But in this case, the problem occurs with just two individual SQL statements, each within its own transaction.
Maybe you are looking for
-
How do I insert multiple pages in a specific order?
I create reports in Word and convert them to Adobe before sending them out to customers. I often need to insert additional (Adobe) pages into the report before sending it out; sometimes I need to insert mulitple (20 or 30) pages. Does anyone know how
-
How to change birthdate entered incorrectly for my child's apple id
An apple id has been set up for my child, but the incorrect birthdate was mistakenly entered. As the adult, I am trying to set up Family Sharing on icloud, and it shows my child listed as an adult. How do I change the birthdate to reflect he is a c
-
Button to b clicked and large image shown on the stage(link to swf file here)
I have a button when clicked is supposed to show a larger image of the button/ I am new to the code and think if I could see and example it would help. This is a school project. I am failing as of now. how do I upload my files to here so I can show
-
CRMXIF_ORDER_SAVE Data structure information
The BAPI CRMXIF_ORDER_SAVE has one input Parameter of type CRMXIF_BUSTRANS. This paramter is quite a complex data structure made upof many data structures; which themselves are complex and contain more data structures. I am a first time user of this
-
Pool data from text file and insert into database
Can anyone tell me how to pool data from a text file and insert into database? let's say my text file is in this format 123456 Peter 22 234567 Nicholas 24 345678 Jane 20 Then I need to insert the all the value for this three column into a table which