Avoid insertion by before trigger
Hi all!
I want to avoid an insertion to a table based on certain conditions.
So I thought I could use a BEFORE trigger. Unfortunately, I don't find a way to avoid it. I can declare a trigger, fetch the conditional information, but whats the command to avoid it?
Maybe I simply overread it, so if someone could give me a hint, I would be very thankful.
regards, Alex
Raise an error
Similar Messages
-
Before Trigger in Discoverer 10.1.2
Hi,
Can any one help me how to build before trigger report in Discoverer. there is a function which internally calling a procedure which has parameters like process_id,organization_name,Gre,start_date,end_date. This process_id will be generated based on a sequence. So, how to pass value for the process_id parameter from Desktop Edition.
example:-
function a(process_id ,start_date,end_date..etc)
procedure(process_id ,start_date,end_date..etc)
insert into temp_table values(process_id,start_date,end_date,etc);
end function a;
In Desktop we created a workbook worksheet we called this function in calculation tab.It has to insert some rows into temp_table and we will create second sheet on this temp_table.
The problem we are facing is we are not able to pass sequence.nextvalue as default value for a parameter. Please suggest.
Thanks inadvance,
Ch.Hanuman PrasadHi,
There is no before report trigger. You may be able to use a logon trigger.
It sounds as though you may want to investigate using database contexts as session parameters which can be set by a workbook or at logon and remain for the duration of the DIscoverer session. Look at these posts for more details:
Re: Passing multiple parameters into Custom Folder...
Re: Parameters in SubQuery
Re: Passing Parameters to a discoverer folder using Note 282249.1
Rod West -
How can you create a simple insert or update trigger
I am trying to create a simple insert or update trigger to timestamp an xml document when I load it into my XML DB repository but I always get an error trying to compile the trigger.
"ORA-25003: cannot change NEW values for this column type in trigger"
Here is my PL/SQL:
CREATE OR REPLACE TRIGGER "PLCSYSADM"."PLCSYSLOG_TIMESTAMP"
BEFORE
INSERT
OR UPDATE ON "PLCSYSADM"."PLCSYSLOG"
FOR EACH ROW BEGIN
:new.sys_nc_rowinfo$ := xmltype('<datestamp>' || SYSDATE || '</datestamp>');
END;
Does anyone have an example that works ?
Thanks in advance
Niels Montananahttp://developer.apple.com/referencelibrary/HardwareDrivers/idxUSB-date.html
-
I have a master table and also detail table. In which trigger i insert the master before the detail? tx
Forms [32 Bit] Version 10.1.2.0.2 (Production)
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Oracle Toolkit Version 10.1.2.0.2 (Production)
PL/SQL Version 10.1.0.4.2 (Production)
Oracle Procedure Builder V10.1.2.0.2 - Production
PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)
Oracle Query Builder 10.1.2.0.2 - Production
Oracle Virtual Graphics System Version 10.1.2.0.2 (Production)
Oracle Tools GUI Utilities Version 10.1.2.0.2 (Production)
Oracle Multimedia Version 10.1.2.0.2 (Production)
I have a detail table with foreigg key batch_no to master table. And the batcch_no is generated using sequence number. So, i don't enter any value to master table.
When the detail is going to be inserted, i need to insert the master first. So, the master record is inserted just before the details. tx. -
How i can reference to variable that i´m inserting into database?
I want create "before trigger" which check if inserting date isn´t bigger than sysdate.
ThanksThis assumes a table name T and a column named date_column. It raises an error if the supplied date is in the future.
create or replace trigger t_trg
before insert on t
for each row
begin
if :new.date_column > sysdate then
raise_application_error(-20000, 'Invalid date');
end if;
end;
/ -
I need to pass null as a default value for a parameter in Before Trigger
Hi All,
I am using Before trigger function in calculation tab which has some set of parameters.So, I accept some parameters which are passed to this Before Trigger function and need these parameters default value as null.
To be clear I want to set the Default value for a parameter in workbook to be NULL and pass the same to the calling Function.
please help me.
Thanks in advanceHi All,
I am using Before trigger function in calculation tab which has some set of parameters.So, I accept some parameters which are passed to this Before Trigger function and need these parameters default value as null.
To be clear I want to set the Default value for a parameter in workbook to be NULL and pass the same to the calling Function.
please help me.
Thanks in advance -
Deactivate "insert element before / remove element" in array
Hello guys.
It is possible to deacitvate "insert element before / remove element" function appears after right-click on a array in the frontpanel?
"Description and Tip" should stay.
Thank you.
Alex
Solved!
Go to Solution.You can customize the right-click shortcut menu to remove some application items and keep others:
Right-click on the array (and not on the array element!) in the front panel and select Advanced->Run-Time Shortcut Menu->Edit...
This brings up the Shortcut Menu Editor:
Change the drop-down control from "Default" to "Custom".
Select the "???" line in the tree control on the left.
on the right, change the Item Type from "User Item" to "Application Item -> Description and Tip..."
It will automatically fill in the corrent Name and Tag.
Save the rtm either into its own file or into the control.
LV will automatically handle application items in the control, no event case needed.
I sometimes find the "Copy entire menu" function of the shortcut menu pretty useful if I only want to disable a few items.
http://zone.ni.com/reference/en-XX/help/371361G-01/lvconcepts/customizing_vis/#Customizing_Menus
-Barrett
CLD -
Inserting pages before pg 1, document then opens to old page 1 (XI Pro)
Dear Support Team,
I am baffled. I use Adobe Acrobat XI Pro 11.0.2. Here is the scenario that is driving me crazy:
I open a multi-page pdf document (titled Report).
I then view the thumbnails of that document.
I find another pdf document (titled Charts) and drag it unopened from my desktop and place it before the thumbnail of the first page of my opened document (Reports).
All seems well, all pages of the Charts pdf were inserted before the first page of the Reports pdf and are showing correctly in thumbnail view.
However, if I close the pdf and reopen it, it will automatically open to the old first page (what used to be the first page of Reports), let's say page 5.
So, I have to go to the file properties and change the "open to page 5" and make it say "open to page 1"
This happens every time I insert a pdf document or even just a pdf page from another document before page 1 in my open document.
It's like Acrobat keeps making the document open to the old page 1 no matter how many pages I insert before the old page 1.
I just want to insert pages and have it open to the new page 1 without having to go to the file properties menu every time.
Can anyone help me?Hello,
Thanks for your time. My acrobat preferences were already set to disable the restore last view settings, so that didn't work.
I've done a bunch of testing since you responded and have discovered that this issue only happens when I insert pages into a pdf document created by our office scanner (Konica Minolta bizhub C452). When I scan a document, it creates a pdf. If I then take that pdf and try to insert another document or page before page 1, the document properties immediately change to "open to page 5" or whatever the original page 1 used to be.
I'm not sure what's going on here. I tried copying the scanned pdf to a different location/drive, and still no luck. This is a bummer because we work with scanned documents so often and frequently need to insert and rearrange pages. For now, whenever I insert pages before page 1, I promptly go to the document properties and change the "open to page" to page 1. Very annoying. -
OIM 11g R2 - Trusted User Recon 'Reconciliation Insert Received' not trigge
Hi,
We have recently upgrade OIM 10g to 11g R2. One thing which we use to depend on in 10g was the 'Reconciliation Insert Received' to trigger of other tasks. This does not seem to work in OIM 11g R2? Is there a way to fix this?This turned out to be an Oracle bug.
Bug 9539918 - BOTH MANAGER ID FIELD AND ORG UNIT FIELD IS DISPLAYED WITH ORG UNIT VALUE
This has been fixed in9.1.2.4 version of the connector. Patch11656991
Sunny
Edited by: Sunny on Mar 15, 2011 1:47 PM -
Regarding before insert and update trigger...Urgent!!
i have written a trigger to trim N upper the 1st field and trim N upper N replace period(.) for second field2 for future records.
When i compile, it says "complied with errors" is gives error as "insuffecient privlages"
Can anyone please figure out what problem is this??? And is my code correct?? if any changes to be done please let me know????
create or replace trigger TRG_test
before insert or update on test
for each row
declare
begin
:new.field1 := trim(upper(:new.field1));
:new.field2 := trim(upper(replace(:new.field2,'.' )));
end;
Urgent please!!!
Thank you in advance.The owner of the tables is User 2 and i am creating the trigger in user1 N i m calling this table from user2...as User2.TEST ...
User 1 as has previliges to acess the user 2 tables, since user2 tables are listed under user1 table section...
Do you system privilages????
I m using PL/SQL devloper tool.... -
How do I "insert characters" before sending an email - to avoid spamming?
I followed normal procedure for forwarding omn an email I had been sent. It would not go, and I was told to add characters as this would avoid spamming as a security measure. This has not been asked before, and only started today. Why? I do not know what to put!
Firefox doesn't have any email features like that.
-
Hi all,
I have a performance issue in the below code,where i am trying to insert the data from table_stg into target_tab and in parent_tab tables and then to child tables via cursor with bulk collect .the target_tab and parent_tab are huge tables and have a row wise trigger enabled on it .the trigger is mandatory . This timetaken for this block to execute is 5000 seconds.Now my requirement is to reduce it to 5 to 10 mins.
can someone please guide me here.Its bit urgent .Awaiting for your response.
declare
vmax_Value NUMBER(5);
vcnt number(10);
id_val number(20);
pc_id number(15);
vtable_nm VARCHAR2(100);
vstep_no VARCHAR2(10);
vsql_code VARCHAR2(10);
vsql_errm varchar2(200);
vtarget_starttime timestamp;
limit_in number :=10000;
idx number(10);
cursor stg_cursor is
select
DESCRIPTION,
SORT_CODE,
ACCOUNT_NUMBER,
to_number(to_char(CORRESPONDENCE_DATE,'DD')) crr_day,
to_char(CORRESPONDENCE_DATE,'MONTH') crr_month,
to_number(substr(to_char(CORRESPONDENCE_DATE,'DD-MON-YYYY'),8,4)) crr_year,
PARTY_ID,
GUID,
PAPERLESS_REF_IND,
PRODUCT_TYPE,
PRODUCT_BRAND,
PRODUCT_HELD_ID,
NOTIFICATION_PREF,
UNREAD_CORRES_PERIOD,
EMAIL_ID,
MOBILE_NUMBER,
TITLE,
SURNAME,
POSTCODE,
EVENT_TYPE,
PRIORITY_IND,
SUBJECT,
EXT_PRD_ID_TX,
EXT_PRD_HLD_ID_TX,
EXT_SYS_ID,
EXT_PTY_ID_TX,
ACCOUNT_TYPE_CD,
COM_PFR_TYP_TX,
COM_PFR_OPT_TX,
COM_PFR_RSN_CD
from table_stg;
type rec_type is table of stg_rec_type index by pls_integer;
v_rt_all_cols rec_type;
BEGIN
vstep_no := '0';
vmax_value := 0;
vtarget_starttime := systimestamp;
id_val := 0;
pc_id := 0;
success_flag := 0;
vstep_no := '1';
vtable_nm := 'before cursor';
OPEN stg_cursor;
vstep_no := '2';
vtable_nm := 'After cursor';
LOOP
vstep_no := '3';
vtable_nm := 'before fetch';
--loop
FETCH stg_cursor BULK COLLECT INTO v_rt_all_cols LIMIT limit_in;
vstep_no := '4';
vtable_nm := 'after fetch';
--EXIT WHEN v_rt_all_cols.COUNT = 0;
EXIT WHEN stg_cursor%NOTFOUND;
FOR i IN 1 .. v_rt_all_cols.COUNT
LOOP
dbms_output.put_line(upper(v_rt_all_cols(i).event_type));
if (upper(v_rt_all_cols(i).event_type) = upper('System_enforced')) then
vstep_no := '4.1';
vtable_nm := 'before seq sel';
select PC_SEQ.nextval into pc_id from dual;
vstep_no := '4.2';
vtable_nm := 'before insert corres';
INSERT INTO target1_tab
(ID,
PARTY_ID,
PRODUCT_BRAND,
SORT_CODE,
ACCOUNT_NUMBER,
EXT_PRD_ID_TX,
EXT_PRD_HLD_ID_TX,
EXT_SYS_ID,
EXT_PTY_ID_TX,
ACCOUNT_TYPE_CD,
COM_PFR_TYP_TX,
COM_PFR_OPT_TX,
COM_PFR_RSN_CD,
status)
VALUES
(pc_id,
v_rt_all_cols(i).party_id,
decode(v_rt_all_cols(i).product_brand,'LTB',2,'HLX',1,'HAL',1,'BOS',3,'VER',4,0),
v_rt_all_cols(i).sort_code,
'XXXX'||substr(trim(v_rt_all_cols(i).ACCOUNT_NUMBER),length(trim(v_rt_all_cols(i).ACCOUNT_NUMBER))-3,4),
v_rt_all_cols(i).EXT_PRD_ID_TX,
v_rt_all_cols(i).EXT_PRD_HLD_ID_TX,
v_rt_all_cols(i).EXT_SYS_ID,
v_rt_all_cols(i).EXT_PTY_ID_TX,
v_rt_all_cols(i).ACCOUNT_TYPE_CD,
v_rt_all_cols(i).COM_PFR_TYP_TX,
v_rt_all_cols(i).COM_PFR_OPT_TX,
v_rt_all_cols(i).COM_PFR_RSN_CD,
NULL);
vstep_no := '4.3';
vtable_nm := 'after insert corres';
else
select COM_SEQ.nextval into id_val from dual;
vstep_no := '6';
vtable_nm := 'before insertcomm';
if (upper(v_rt_all_cols(i).event_type) = upper('REMINDER')) then
vstep_no := '6.01';
vtable_nm := 'after if insertcomm';
insert into parent_tab
(ID ,
CTEM_CODE,
CHA_CODE,
CT_CODE,
CONTACT_POINT_ID,
SOURCE,
RECEIVED_DATE,
SEND_DATE,
RETRY_COUNT)
values
(id_val,
lower(v_rt_all_cols(i).event_type),
decode(v_rt_all_cols(i).product_brand,'LTB',2,'HLX',1,'HAL',1,'BOS',3,'VER',4,0),
'Email',
v_rt_all_cols(i).email_id,
'IADAREMINDER',
systimestamp,
systimestamp,
0);
else
vstep_no := '6.02';
vtable_nm := 'after else insertcomm';
insert into parent_tab
(ID ,
CTEM_CODE,
CHA_CODE,
CT_CODE,
CONTACT_POINT_ID,
SOURCE,
RECEIVED_DATE,
SEND_DATE,
RETRY_COUNT)
values
(id_val,
lower(v_rt_all_cols(i).event_type),
decode(v_rt_all_cols(i).product_brand,'LTB',2,'HLX',1,'HAL',1,'BOS',3,'VER',4,0),
'Email',
v_rt_all_cols(i).email_id,
'CORRESPONDENCE',
systimestamp,
systimestamp,
0);
END if;
vstep_no := '6.11';
vtable_nm := 'before chop';
if (v_rt_all_cols(i).ACCOUNT_NUMBER is not null) then
v_rt_all_cols(i).ACCOUNT_NUMBER := 'XXXX'||substr(trim(v_rt_all_cols(i).ACCOUNT_NUMBER),length(trim(v_rt_all_cols(i).ACCOUNT_NUMBER))-3,4);
insert into child_tab
(COM_ID,
KEY,
VALUE)
values
(id_val,
'IB.Correspondence.AccountNumberMasked',
v_rt_all_cols(i).ACCOUNT_NUMBER);
end if;
vstep_no := '6.1';
vtable_nm := 'before stateday';
if (v_rt_all_cols(i).crr_day is not null) then
insert into child_tab
(COM_ID,
KEY,
VALUE)
values
(id_val,
--'IB.Correspondence.Date.Day',
'IB.Crsp.Date.Day',
v_rt_all_cols(i).crr_day);
end if;
vstep_no := '6.2';
vtable_nm := 'before statemth';
if (v_rt_all_cols(i).crr_month is not null) then
insert into child_tab
(COM_ID,
KEY,
VALUE)
values
(id_val,
--'IB.Correspondence.Date.Month',
'IB.Crsp.Date.Month',
v_rt_all_cols(i).crr_month);
end if;
vstep_no := '6.3';
vtable_nm := 'before stateyear';
if (v_rt_all_cols(i).crr_year is not null) then
insert into child_tab
(COM_ID,
KEY,
VALUE)
values
(id_val,
--'IB.Correspondence.Date.Year',
'IB.Crsp.Date.Year',
v_rt_all_cols(i).crr_year);
end if;
vstep_no := '7';
vtable_nm := 'before type';
if (v_rt_all_cols(i).product_type is not null) then
insert into child_tab
(COM_ID,
KEY,
VALUE)
values
(id_val,
'IB.Product.ProductName',
v_rt_all_cols(i).product_type);
end if;
vstep_no := '9';
vtable_nm := 'before title';
if (trim(v_rt_all_cols(i).title) is not null) then
insert into child_tab
(COM_ID,
KEY,
VALUE )
values
(id_val,
'IB.Customer.Title',
trim(v_rt_all_cols(i).title));
end if;
vstep_no := '10';
vtable_nm := 'before surname';
if (v_rt_all_cols(i).surname is not null) then
insert into child_tab
(COM_ID,
KEY,
VALUE)
values
(id_val,
'IB.Customer.LastName',
v_rt_all_cols(i).surname);
end if;
vstep_no := '12';
vtable_nm := 'before postcd';
if (trim(v_rt_all_cols(i).POSTCODE) is not null) then
insert into child_tab
(COM_ID,
KEY,
VALUE)
values
(id_val,
'IB.Customer.Addr.PostCodeMasked',
substr(replace(v_rt_all_cols(i).POSTCODE,' ',''),length(replace(v_rt_all_cols(i).POSTCODE,' ',''))-2,3));
end if;
vstep_no := '13';
vtable_nm := 'before subject';
if (trim(v_rt_all_cols(i).SUBJECT) is not null) then
insert into child_tab
(COM_ID,
KEY,
VALUE)
values
(id_val,
'IB.Correspondence.Subject',
v_rt_all_cols(i).subject);
end if;
vstep_no := '14';
vtable_nm := 'before inactivity';
if (trim(v_rt_all_cols(i).UNREAD_CORRES_PERIOD) is null or
trim(v_rt_all_cols(i).UNREAD_CORRES_PERIOD) = '3' or
trim(v_rt_all_cols(i).UNREAD_CORRES_PERIOD) = '6' or
trim(v_rt_all_cols(i).UNREAD_CORRES_PERIOD) = '9') then
insert into child_tab
(COM_ID,
KEY,
VALUE)
values
(id_val,
'IB.Correspondence.Inactivity',
v_rt_all_cols(i).UNREAD_CORRES_PERIOD);
end if;
vstep_no := '14.1';
vtable_nm := 'after notfound';
end if;
vstep_no := '15';
vtable_nm := 'after notfound';
END LOOP;
end loop;
vstep_no := '16';
vtable_nm := 'before closecur';
CLOSE stg_cursor;
vstep_no := '17';
vtable_nm := 'before commit';
DELETE FROM table_stg;
COMMIT;
vstep_no := '18';
vtable_nm := 'after commit';
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
success_flag := 1;
vsql_code := SQLCODE;
vsql_errm := SUBSTR(sqlerrm,1,200);
error_logging_pkg.inserterrorlog('samp',vsql_code,vsql_errm, vtable_nm,vstep_no);
RAISE_APPLICATION_ERROR (-20011, 'samp '||vstep_no||' SQLERRM:'||SQLERRM);
end;
ThanksIts bit urgent
NO - it is NOT urgent. Not to us.
If you have an urgent problem you need to hire a consultant.
I have a performance issue in the below code,
Maybe you do and maybe you don't. How are we to really know? You haven't posted ANYTHING indicating that a performance issue exists. Please read the FAQ for how to post a tuning request and the info you need to provide. First and foremost you have to post SOMETHING that actually shows that a performance issue exists. Troubleshooting requires FACTS not just a subjective opinion.
where i am trying to insert the data from table_stg into target_tab and in parent_tab tables and then to child tables via cursor with bulk collect .the target_tab and parent_tab are huge tables and have a row wise trigger enabled on it .the trigger is mandatory . This timetaken for this block to execute is 5000 seconds.Now my requirement is to reduce it to 5 to 10 mins.
Personally I think 5000 seconds (about 1 hr 20 minutes) is very fast for processing 800 trillion rows of data into parent and child tables. Why do you think that is slow?
Your code has several major flaws that need to be corrected before you can even determine what, if anything, needs to be tuned.
This code has the EXIT statement at the beginning of the loop instead of at the end
FETCH stg_cursor BULK COLLECT INTO v_rt_all_cols LIMIT limit_in;
vstep_no := '4';
vtable_nm := 'after fetch';
--EXIT WHEN v_rt_all_cols.COUNT = 0;
EXIT WHEN stg_cursor%NOTFOUND;
The correct place for the %NOTFOUND test when using BULK COLLECT is at the END of the loop; that is, the last statement in the loop.
You can use a COUNT test at the start of the loop but ironically you have commented it out and have now done it wrong. Either move the NOTFOUND test to the end of the loop or remove it and uncomment the COUNT test.
WHEN OTHERS THEN
ROLLBACK;
That basically says you don't even care what problem occurs or whether the problem is for a single record of your 10,000 in the collection. You pretty much just throw away any stack trace and substitute your own message.
Your code also has NO exception handling for any of the individual steps or blocks of code.
The code you posted also begs the question of why you are using NAME=VALUE pairs for child data rows? Why aren't you using a standard relational table for this data?
As others have noted you are using slow-by-slow (row by row processing). Let's assume that PL/SQL, the bulk collect and row-by-row is actually necessary.
Then you should be constructing the parent and child records into collections and then inserting them in BULK using FORALL.
1. Create a collection for the new parent rows
2. Create a collection for the new child rows
3. For each set of LIMIT source row data
a. empty the parent and child collections
b. populate those collections with new parent/child data
c. bulk insert the parent collection into the parent table
d. bulk insert the child collection into the child table
And unless you really want to either load EVERYTHING or abandon everything you should use bulk exception handling so that the clean data gets processed and only the dirty data gets rejected. -
Using a sequence inside BEFORE TRIGGER
Hi all,
I just created a testtable and a sequence to use as a primary key column value for that table.
I tried to create a BEFORE INSERT trigger on that table and in the trigger i tried to set up the primary key column value using the sequence
but while compiling i am getting the error "Error(9,30): PLS-00357: Table,View Or Sequence reference 'SEQ_OF_TESTTABLE.NEXTVAL' not allowed in this context"
My Version:Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
All the objects created with the same user. I would appraciate any help, thanks all
EDIT
I solved the problem using the below
create or replace
TRIGGER Bef_Ins_On_Testtable
BEFORE INSERT ON TestTable
FOR EACH ROW
declare
ntemp_id INT;
BEGIN
SELECT SEQ_OF_TESTTABLE.NEXTVAL INTO ntemp_id FROM DUAL ;
DBMS_OUTPUT.PUT_LINE('İNSERTED');
:NEW.VSURNAME := 'HAKKİ' ;
:NEW.NID := ntemp_id;
END;But i wonder why i can use the sequence(just as seqeunce_name.NEXTVAL) in INSERT statement and why cant in trigger?
Edited by: user9371286 on 31.Tem.2010 04:15
Edited by: user9371286 on 31.Tem.2010 04:21
Edited by: user9371286 on 31.Tem.2010 04:27Please post your trigger code and your database version ( the result of: select * from v$version; ).
Put it between tags, so your example will stay formatted.
(see: http://forums.oracle.com/forums/help.jspa for more examples regarding tags)
"PLS-00357: Table,View Or Sequence reference "string" not allowed in this context
Cause: A reference to database table, view, or sequence was found in an inappropriate context. Such references can appear only in SQL statements or (excluding sequences) in %TYPE and %ROWTYPE declarations. Some valid examples follow: SELECT ename, emp.deptno, dname INTO my_ename, my_deptno, my_dept .FROM emp, dept WHERE emp.deptno = dept.deptno; DECLARE last_name emp.ename%TYPE; dept_rec dept%ROWTYPE;
Action: Remove or relocate the illegal reference."
+http://download.oracle.com/docs/cd/B19306_01/server.102/b14219/plsus.htm#sthref13592+
You can find examples of triggers referring to sequences here, by doing a search on this forum or:
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_triggers.htm#ABC1032282 -
Why RandomAccessFile inserts space before each character while writing?
Ater running the following code, the file test.txt contain:
a b c d e f g h i j k l m n o p q r s t u v w x y z
Why writeChars() inserted a space before each charecter?
How to avoid this unwanted insertion?
try {
RandomAccessFile raf = new RandomAccessFile ("c:/test.txt", "rw");
raf.writeChars("abcdefghijklmnopqrstuvwxyz");
raf.close();
catch(Exception e) {
System.out.println(e.getMessage());
}a char in java is a 16 bit datatype. (Allowing special chars like Norwegian ��� ���, German �� and many more from many languages). The ASCII system uses bytes for characters. (Allowing only 256 different chars). If you reed the file as byte you must write it as bytes as well. If you write the file as chars (16 bit cars) you must read the file as (16 bit) chars as well.
-
AFTER INSERT OR UPDATE TRIGGER
All of my tables have a dateTime field which is used to track when a record was inserted/updated. I would like a trigger on each table that updates the dateTime field with the current date and time after each insert or update. I keep getting a mutating error and I can't quit wrap my brain around how to fix it. Could anyone provide a example.
I know I am getting the error because I am trying to update the row that is currently being inserted or updated - what is the best way to handle this?
ThanksHi,
A trigger before insert or update is better for your case :
For example :
SQL> desc tab_param
DELAI_RETENTION_FLUX NOT NULL NUMBER(5)
DATE_DEBUT_ALARME NOT NULL DATE
DATE_DEBUT_HITSTORIQUE NOT NULL DATE
NB_FLUX_TOTAL NOT NULL NUMBER(5)
NB_FLUX_PAGE NOT NULL NUMBER(5)
DATE_COL DATE
CREATE OR REPLACE TRIGGER TEST_TRG BEFORE INSERT OR
UPDATE OF DATE_DEBUT_ALARME, DATE_DEBUT_HITSTORIQUE,
DELAI_RETENTION_FLUX, NB_FLUX_PAGE, NB_FLUX_TOTAL
ON TAB_PARAM REFERENCING OLD AS old NEW AS new
FOR EACH ROW
begin
:new.date_col:=sysdate;
end;
Nicolas.
Maybe you are looking for
-
What are the defects of the new ipad?
What Are the defects of the new ipad 3?
-
APO DP - load from InfoCube to a 'fixed' cell in planning area
I am using APO DP V5. Suppose I have a key figure which is fixed for a particular time bucket cell. If I try and load data into this cell from an InfoCube, what will be the effect? I assume that the cell will NOT be udpated. Regards, Bob Austin, Atos
-
7520 all in one will not print photos from photo tray from computer
7520 all in one printer photodmart will not print photos from computer from the photo tray
-
Report PM Canu00B4t do it Left join
Hi!!! I have the following agenda on which I need to make a report containing the following: number of notice, application for order, request offer, but asked whether a computer need not have even asked to appear on the list this is my program: I hop
-
Java logging API (1.4) -- where's the file?
Where on God's green earth does the log file get written to? I am doing some very simple code: import java.util.logging.*; public class SimpleLogging { static Logger jcfeLog = Logger.getLogger("test1"); static Logger sampleLog = Logger.getLogge