SQL & PL/SQL :: Create Test Table - Trigger Throw Error Message

Mar 4, 2010

create table test123 as (unit varchar2(5),qty varchar2(25));
insert into test123('ABC','10,40,50');
insert into test123('PQR','20,30,40,10');
insert into test123('XYZ','20,10,70');

I have a table called test123 which qty field. if the sum of qty is entered more than 100 or less than 100, it should throw error.

I wrote this trigger..but it is not working.

create or replace restrict_sum
after insert or update of qty on test123
for each row
declare
v_sum number;
[code].........

View 5 Replies


ADVERTISEMENT

SQL & PL/SQL :: Create Test Table - Instead Of Trigger

Dec 30, 2010

table
CREATE TABLE "TEST"
("CONTRACT_REF_NO" VARCHAR2(20 BYTE) primary key,
"CHG_GL" VARCHAR2(9 BYTE),
"CHG_GL_1" VARCHAR2(9 BYTE),
"CHG_GL_2" VARCHAR2(9 BYTE),

[code]...

10 rows selected.

create or replace view test_view
as
select 1 id,CONTRACT_REF_NO,chg_gl
from test
union all

[code]...

11 rows selected.

I have done only for one id.

so the problem is the front end is showing this test_view that people will modify.but they have to actually modify the table ,so I can think of an instead of trigger(instead of insert and instead of update ones).

View 16 Replies View Related

SQL & PL/SQL :: Create Trigger Which Will Test Database Link?

Aug 29, 2012

I want to create a database trigger which will test the database link, if it is ok then it will use dblink and do its work.

If it fails then it will send the data into its own server logfile.

I Wrote:

CREATE OR REPLACE TRIGGER PERMIT.TESTTRG
AFTER INSERT OR UPDATE
ON PERMIT.TR_LP_M_H_COMPANY_25072012
REFERENCING NEW AS New OLD AS Old
FOR EACH ROW
Declare
l number; nIgn PLS_INTEGER; nRows PLS_INTEGER := 0;

[code]....

When I execute it it is giving error:

LINE/COL ERROR
-------- -----------------------------------------------------------------
4/11 PLS-00201: identifier 'EXEC_SQL.CONNTYPE' must be declared
4/11 PL/SQL: Item ignored
8/2 PLS-00320: the declaration of the type of this expression is
incomplete or malformed

[code]....

View 4 Replies View Related

PL/SQL :: ORA-01840 - Executed Function - Throw Error?

Mar 7, 2013

I cerated a function with two date parameters. I am using these parameters in query. The function created successfully.But when i executed this function, it throw following error:

ORA-01840: input value not long enough for date format in function

I searched on internet, but not found the proper solution. n with example.Table column is varchar2 type and values store in 'RRRR/MM/DD' format.

View 3 Replies View Related

Error Message When Attempting To Create 3rd Column

Jul 26, 2010

I've set up a query that creates 2 columns 'UVLCredit' and 'UVLDebit' and what I'm trying to do is subtract the 'UVLDebit' column from the 'UVLCredit' column and have the resulting value show up in a column called 'UVLTotal.

I'm multiplying 1 column times another to create a new column called UVLCredit, and then doing it again (with a different column) to create a 2nd new column called UVLDebit...the last thing I'm trying to do is to take the results of the 1st new column and subtract the results of the 2nd newly created column to create a 3rd new column called UVLTotal. The error states that the 'UVLDebit' column is an invalid identifier.

See code below....

CODESELECT          
T.PO_RELEASE_NBR, T.PO_LINE_STATUS, T.FACILITY,        
TI.STATUS_DATE, TI.QTY_ORDERED_UP,
TI.PO_UNIT_PRICE, TI.QTY_REC_TOTAL_UP, TI.QTY_INVOICED_UP,
[b]sum(TI.PO_UNIT_PRICE) * (TI.QTY_REC_TOTAL_UP) as "UVLCredit",
sum(TI.PO_UNIT_PRICE) * (TI.QTY_INVOICED_UP) as "UVLDebit",
[code]........        

View 3 Replies View Related

SQL & PL/SQL :: CREATE OR REPLACE - Error During Execution Of Trigger

Aug 9, 2011

I create this trigger:

CREATE OR REPLACE TRIGGER T_HST AFTER INSERT
On HST
FOR EACH ROW
DECLARE
Begin
INSERT INTO HST (EMP_NO, START_DATE )
SELECT EMP_NO, SYSDATE
FROM HST
WHERE EMP_NO = :NEW.EMP_NO;
End T_HRS_SAL_PERIOD_HSTY_UPD_PRI;
/

when I insert a new record in table HST I get this error:

ORA-04091: table HST is mutating, trigger/function may not see it
ORA-06512: at "T_HST", line 3
ORA-04088: error during execution of trigger 'T_HST'

What I wrong in this trigger?How can I modify it?

View 7 Replies View Related

SQL & PL/SQL :: Create Table Using Trigger

Feb 1, 2013

Is it possible to create table using trigger?

I tried but failed...

CREATE OR REPLACE TRIGGER tri1
AFTER UPDATE
ON dept
FOR EACH ROW
declare
pragma AUTONOMOUS_TRANSACTION;
BEGIN
execute immediate 'create table dept_dum as select * from dept';
END;
/

SQL> update dept set deptno=23 where deptno=10;
update dept set deptno=23 where deptno=10
*
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "SCOTT.TRI1", line 6
ORA-04088: error during execution of trigger 'SCOTT.TRI1'

I am running this as scott user

My requirement is to

create table as select * from table_name where flag=1

This has to be done parallel for all the tables for which this flag is enabled and by that trigger delete all those rows which were backed up as table.

View 4 Replies View Related

SQL & PL/SQL :: Create Trigger On Table After Update?

Apr 16, 2013

i have created a trigger on a table after update. i am using if condition if the condition is true i am passing a value and then inserting into audit table.

if(condtion)
L_change_type='value'
end if;
if(condtion)
L_change_type='value'
end if;
if(condtion)
L_change_type='value'
end if;
if(condtion)
L_change_type='value'
end if;

Then i am inserting

Insert into audit_table(change_type.....)
values(..L_change_type)...)

If i want to skip the insert statement for particular condition wt i have to do.

View 7 Replies View Related

SQL & PL/SQL :: Create Trigger On (account) Table?

Nov 23, 2008

I gave this a shot on my own, and failed, so I am putting the question to you:

I am looking to create a trigger on the "Account" table

CREATE TABLE Account(Acct_no number, BillAmt number, OpenDate Date, SSN number,
Primary Key (Acct_no),
Foreign Key(SSN) references ResponsibleParty(SSN));

which will update the BillAmt field whenever one of the account's respective records is inserted/updated/deleted from the following tables:

CREATE TABLE Plan(Plan_id number, Cost number, Minutes number,
primary key(Plan_id));
CREATE TABLE Feature(Feature_id number, Description varchar(20), Cost number,
primary key(Feature_id));

These tables are linked through the following table:

CREATE TABLE Phone_Line(MTN number, cStart Date, cEnd Date,
rDate Date, Status char, ESN number, Acct_no number, Plan_id number,
primary key(MTN),
foreign key(ESN) references Equiptment(ESN), foreign key( Acct_no) references Account(Acct_no),
foreign key(Plan_id) references Plan(Plan_id));

View 26 Replies View Related

SQL & PL/SQL :: Create Trigger On Certain Column For Table Structure

Nov 3, 2011

create trigger on certain column for table structure.

SQL> desc MXMS_BF_TXN_DTL_T
Name Null? Type
----------------------------------------- -------- ----------------------------
DOC_NO NOT NULL VARCHAR2(200)
SEQ_NO NOT NULL NUMBER(24)
GL_CODE VARCHAR2(200)
TXN_NATURE VARCHAR2(200)
TXN_TYPE_CODE VARCHAR2(200)
[code].....

I need to collect new and old data whenever update statement fire on DOC_NO,POLICY_KEY,CRT_USER column.i have created only audit table for the above as below structure .

Name Null? Type
----------------------------------------- -------- ----------------------------
TIMESTAMP DATE
WHO VARCHAR2(30)
CNAME VARCHAR2(30)
OLD VARCHAR2(2000)
NEW VARCHAR2(2000)

Description:- TIMESTAMP is for when the modification happen.
WHO is for username
CNAME is for column which is modified
OLD is for old value for the modified column
New os for new value for the modified column

View 3 Replies View Related

Create A Trigger Before Update On Table Test1?

Dec 25, 2010

i have two table:

QUOTE create table test1(
num number(4),
name varchar2(50));
create table test2(
num1 number(4),
name1 varchar2(50));

then i want to create a trigger before update on table test1 that i want to insert in table test2 the old values in table test1:

for example

QUOTE insert into test1(1,'cocol');
QUOTE update test1
set name='oracle' where num=1;

so i want the trigger to insert 1 and cocol into the table test2.

View 1 Replies View Related

PL/SQL :: Action Of Trigger To Create Records In Table

May 14, 2013

Using oracle 11.2.0.3 and wish to do the following.

Have trigger on table a on database a.

When a record is inserted into table a a record should be written first to table1 on database b , committed then a record written to table2 on database b as table2 has fk dependency on table 1.

How can we best achieve this.

Getting problems with the commit inside the trigger have tried pragma autonous transaction as well.

Get ora-02064 distributed transaction not supported when use the following code

create or replace trigger por_TRG_POP_IKNOW_MULTIPLE2

after INSERT OR UPDATE or delete   on por_MULTIPLE

for each row

-- tO ENSURE I-KNOW KEPT UP-TO-DATE WITH HOMIS MULTIPLE
-- delib not delet form i-know as if has been used by customer cannot delete
-- due to referential inetgrity constraints in i-know
-- Note parent_num updated on IKW via support.maintain_latest_dim_version.update_multiple until
-- When IKW becomes master of multiple info, this trigger can be removed
-- and support.maintain_latest_dim_version.update_multiple removed

declare
PRAGMA AUTONOMOUS_TRANSACTION;
v_dml_type varchar2(1);
begin
IF INSERTING OR UPDATING

[Code]....

--when matched THEN update set
--      a.MGRP_NUM b.mult_link_multiple_num,
--      MGRP_DESCRIPTION = (select mult_name from por_multiple
  --     where mult_code = mult_link_multiple_code

when not matched

then insert
(
a.MGRP_NUM,
a.MGRP_DESCRIPTION

)

[Code]...

View 7 Replies View Related

Create Trigger So That Whenever Record In Employee Table Deleted?

Dec 7, 2009

I'm trying to create a trigger so that whenever a record in the Employee table is deleted, a trigger will automatically delete corresponding records in the Job History table, then the Employee record is archived to EmployeeArchive before it is deleted. It compiles but with warnings. Here's what I've got.

CREATE TABLE EmployeeArchive
(EmployeeID Int, FirstName Char, LastName Char,
EMail Char, PhoneNumber Int, HireDate Date, JobID Char, Salary Int,
Commission Int, ManagerID Int, DepartmentID Char);

[Code]....

View 11 Replies View Related

SQL & PL/SQL :: Create Trigger To Change Every Insert In Table To Sysdate

Feb 17, 2011

I have table 'A' with column 'ID','NAME','IN_DATE','PHONE','EMAIL'

Now I have to create a trigger such that on every insert in the table 'A' the value of column 'IN_DATE' changes to sysdate.I m not good in PL/SQL

View 4 Replies View Related

Create Trigger On Table / Populate With Data From Additional Tables

Nov 7, 2010

I would like to create a trigger on a table which populates a log table. In addition to using the table where the trigger will exist, I would like to populate a couple more fields in the log table with with data from 2 other tables.

e.g.

NAME_TABLE
-reg_id
-name

ADDRESS_TABLE *trigger to be fired when a new record is created here.
-reg_id
-srv_id

PROCESS_TABLE
-srv_id
-start_time
-end_time

This is what I would like the logging table to look like:

LOGGING_TABLE
-address_table_reg_id
-address_table.srv_id
-name_table.name
-process_table.start_time
-process_table.end_time

How can I go about creating this type of trigger?

View 2 Replies View Related

Application Express :: 4.1 Create Webservice Reference / Test

Aug 29, 2012

I created an report and made it accessible as Restfull server. When I checked the url, I got an XML back. So the service is working.

As test I wanted to create a webservice reference to that same page, but receive ORA-06502 PL/SQL: numeric or value error: hex to raw conversion error whenever I test the service. I tried all kind of options.

Settings:
URL ...........
HTTP MEthod : GET
Parameters
app
page
reportid
(and even parmvalues, lang, output)
outputformat : XML

When I test this service I receive above error. I use Apex 4.1

View 0 Replies View Related

SQL & PL/SQL :: Mutating Trigger Error Using Global Temporary Table?

Jun 21, 2010

How can we overcome mutating trigger error using global temporary table.

Suppose if we use the following trigger we will get mutating trigger error.

CREATE OR REPLACE TRIGGER t1
AFTER INSERT ON emp
FOR EACH ROW
DECLARE
BEGIN
UPDATE emp SET sal=sal+100;
END;
/

View 27 Replies View Related

SQL & PL/SQL :: AFTER INSERT Or UPDATE Trigger Failed - Mutating Table Error

Jul 4, 2013

Table A basically has 4 rows of interest, an outside event changes/inserts let's say row 1.

Row 2 and 3 have to be changed in a trigger depending on the new value of 1.(or not if the value stays the same)

Row 4 is the reference for the update and will not be changed.

My first simple AFTER INSERT or UPDATE trigger obviously failed because of the mutating table error.

View 19 Replies View Related

Windows :: Error / Test Failed / Provider Cannot Be Found

Feb 25, 2013

We just upgraded one of our databases to 11g on a new server. The 3rd party application that accesses the db is 32 bit. The software needs to be running on the db server in order for some transactions to occur. Since the oracle client on the db server is 64bit do we need to install a 32 bit client as well. As of right now we are getting an error in the software when trying to connect to the db that says "Test failed. provider cannot be found. it may not be properly installed." This is a live production server so uninstalling and reinstalling oracle is not really an option at this time (unless absolutely necessary). How will installing a 32 bit oracle client effect everything (if that is the route we need to take).

View 3 Replies View Related

Keep Getting PLS-00306 Error Message?

Aug 26, 2013

I keep getting PLS-00306 error message.

I am also getting an error that the statement was ignored.

View 5 Replies View Related

SQL & PL/SQL :: Creating Custom Error Message

Apr 24, 2013

I am trying to create my own error message but when ever i used sp_addmessage it gives error sp2-0734 unknown command biggning... what to do?

View 12 Replies View Related

SQL & PL/SQL :: Error Message In Execute Immediate Command

May 30, 2012

I have created a procedure, which should be executed on the below condition with EXECUTE IMMEDIATE COMMAND. But i am getting error.

The error shows the procedure/function name is not existing. But it is exist.

SQL>
1 Declare
2 a varchar2(20);
3 b varchar2(20);
4 c varchar2(1000);
5 begin
6 select to_char(sysdate,'day') into a
7 from dual;
8 select to_char(sysdate,'HH24') into b
9 from dual;
10 if
11 (a='friday' and b>=22)
12 or
13 (a='saturday' and b<=6)
14 or
15 (a='wednesday' and b>=9)
16 then
17 begin
18 EXECUTE IMMEDIATE ('begin'||BACKUP_AUTO_execute_bat_file||'end;');
19 end;
20 else
21 null;
22 end if;
23* end;
SQL> /
EXECUTE IMMEDIATE ('begin'||BACKUP_AUTO_execute_bat_file||'end;');
*
ERROR at line 18:
ORA-06550: line 18, column 32:
PLS-00222: no function with name 'BACKUP_AUTO_EXECUTE_BAT_FILE' exists in this
scope
ORA-06550: line 18, column 4:
PL/SQL: Statement ignored

View 6 Replies View Related

PL/SQL :: EXCEL TEMPLATE Error Message?

Oct 31, 2013

i have a xml sheet which contain 30 attributes,and only because of one attribute i got this error when i preview my xls sheet and the rest 29 attribute is working correctly.

   Start Excel Previewonly open: falsemTemplate: C:Documents and Settingsesys36Local SettingsApplication DataOracleBIPublisherTemplateBuilderforExcel mp mp mp.xlsmTmpTemplate: C:Documents and Settingsesys36Local SettingsApplication DataOracleBIPublisherTemplateBuilderforExcel mp/tmp.xlsjava.lang.NumberFormatException: multiple points    at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)    at java.lang.Double.valueOf(Unknown Source)    at oracle.xdo.template.excel.render.BookDataWriter.copyCell(BookDataWriter.java:766)    at

[code]....

View 1 Replies View Related

SQL & PL/SQL :: Select Data From Test-1 Table Where ID Values In Table Exists In 2?

Aug 31, 2010

I have the below data in table test_1.

select * from test_1
IDNameTotal
-----------
1A100
2B100
3C100
4D100

test_2 table contains the concatination of ID's with comma seperated. Actually in this table ID column is of datatype varchar2.
select * from test_2
ID
----
1,2,3

My requirement is to select the data from test_1 table where the id values in this table exists in test_2 table. I tried with the belowselect statement, but could not get any data.

SELECT * FROM test_1 WHERE to_char(id) IN (SELECT id FROM test_2)

create table test_1 (id number, name varchar2(100), total number)
create table test_2(id varchar2(100))
insert into test_1 values (1,'A',100)
insert into test_1 values (2,'B',100)
insert into test_1 values (3,'C',100)
insert into test_1 values (4,'D',100)

View 4 Replies View Related

Server Utilities :: SQL Loader Error Message?

Oct 6, 2000

When I try to load a .TXT file into an Oracle table, the following message is given at the command prompt;

SQL*Loader-524: partial record found at end of datafile

and the load is not successful. The control file is as follows;

Load Data
INFILE 'c:spledlsubj.txt'
APPEND
INTO TABLE tblSubjectiveCode

[code]...

Could the .TXT file causing any problems ?

View 7 Replies View Related

Forms :: Error Message - Could Not Reserve Record (2 Tries) Keep Trying

Apr 21, 2011

when i running my form i m receiving this error message Error Message is "Could not reserve record (2 tries) keep trying ? " This is due to multi user Login, How can i avoid from this error message.

View 26 Replies View Related

Error Message When Debugging Dynamic Sql Procedure?

Nov 13, 2007

I get this error message when debugging this dynamic sql procedure:

ORA-00922: missing or invalid option
ORA-06512: at "PLANNING_PWR.RUNNING_TIMES_EXP", line 66
ORA-06512: at line 12

I cannot find where the error is.

CREATE OR REPLACE
procedure running_times_exp(p_table_name IN VARCHAR2,
p_pattern in varchar2,
p_f_date IN DATE,

[code]...

View 6 Replies View Related

Application Express :: How To Make Error Message Red

May 20, 2013

A page has a display-only text item that is populated when a rare exceptional condition arises. I'd like for the text to be colored red. While editing the item, in the Element region,

I populated the item "HTML Form Element Attributes" by selecting 'style="font-color:red"' from the drop-down list. When the text displays, however, the color is still the default black. What do I need to do to turn the text red?

View 2 Replies View Related

Server Administration :: Error Message In Oracle Scheduler

Apr 10, 2012

I want to create a schedule as below. But it shows error message which i cant understand.

begin
DBMS_SCHEDULER.CREATE_jOB(
job_name => 'Alert_monitor',

[Code]....

Here is the error message.

Error at line 1
ORA-06550: line 2, column 1:
PLS-00306: wrong number or types of arguments in call to 'CREATE_JOB'
ORA-06550: line 2, column 1:
PL/SQL: Statement ignored

View 3 Replies View Related

(failed To Close File) Error Message While Backing Up DB?

May 30, 2012

We have been getting the below error message, while backing up the DB(Full DB backup) via netbackup. The DB version is 10.2.0.3 (64bit). The archive backup goes fine. the problem is with the full backup.

input datafile fno=00241 name=/u106/oradata/iwhdbqa/iwh_mvlog_01x.dbf
channel CH02: starting piece 1 at 29-MAY-12
RMAN-03009: failure of backup command on CH01 channel at 05/29/2012 21:41:28
ORA-19506: failed to create sequential file, name="iwhdbqa_20120529210533_db_ipnc7n6l_1_1", parms=""

[code]...

I came to know that this is a netbackup configuration/client bug. Can we do something from the oracle side.

The RMAN COMMAND STRINGS we use is as follows:

SET SNAPSHOT CONTROLFILE NAME TO '/u101/app/oracle/product/10.2.0.5/db_1/dbs/iwhdbqa_snapshot_db.snap';
RUN {
ALLOCATE CHANNEL CH01 TYPE 'SBT_TAPE' parms='SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so64.1' ;
SEND 'NB_ORA_SERV=atlbackupmaster, NB_ORA_POLICY=iwh-dbqa_oracle, NB_ORA_CLIENT=iwh-dbqa-bu';
ALLOCATE CHANNEL CH02 TYPE 'SBT_TAPE' parms='SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so64.1' ;

[code]...

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved