SQL & PL/SQL :: Write Trigger On A New Table - Body Not Working Properly?

Jun 29, 2010

I am trying to write a trigger on a new table. (dest_test) This is the first trigger that I have ever attempted (fairly new DBA) and I am having some trouble with the trigger body.It is a before insert trigger that will need to select from another table (dest) for a particular value being inserted (destination).

create table dest_test (
destination varchar2(4) not null,
db_name varchar2(10) not null
)

desc dest

[code]...

I am getting the exact opposite results than I want, though. If the value appears in dest, it is inserting into dest_test... NOT whatI want it to do!If the value doesn't appear in dest, it is throwing ora-6512 and ora-4088 errors. Is there a way to suppress these errors, or to graceful exit from the block so that the trigger completes without throwing these errors?

View 3 Replies


ADVERTISEMENT

Log Of Materialized View - Trigger Not Working Properly

Oct 25, 2012

I have created a Table and a log of materialized view in an Schema SchemaAA of Server A

CREATE TABLE TABLA_TEST
(
TEST_PK NUMBER,
TEST_TEXTO VARCHAR2(50),
CONSTRAINT PK_TEST PRIMARY KEY (TEST_PK)
);

CREATE MATERIALIZED VIEW LOG ON TABLA_TEST;

I have created a DB Link from server B with user REPLIC

I have granted SELECT to REPLIC to the table and the log materialized View.

I have created a table in instanceBA of Server B

CREATE TABLA_TEST
(
HOSPCODE NUMBER(3),
TEST_PK NUMBER,
TEST_TEXTO VARCHAR2(50),
FECHA_INSERT DATE,
FECHA_UPDATE DATE,
FECHA_DELETE DATE,
CONSTRAINT TTEST_PK PRIMARY KEY (HOSPCODE, TEST_PK);

I have created a materialized view in schema SchemaBB of Server B with a trigger

CREATE MATERIALIZED VIEW WORKAREA.TABLA_TEST70
BUILD IMMEDIATE
REFRESH FAST ON DEMAND
WITH PRIMARY KEY
AS
SELECT TEST_PK,
TEST_TEXTO
[code].........

All schemas have the appropriate grants.

When inserting in TABLA_TEST (SchemaAA) and refreshing MView TABLA_TEST70 things go nicely.

But, when updating a record in the original TABLA_TEST and refreshing the MView the results in TABLA_TEST in SchemaBA are as if I have deleted the record (FECHA_DELETE is set to SYSDATE).

View 1 Replies View Related

SQL & PL/SQL :: Write Trigger On Table Which Contain Lot Of Parameters?

Apr 17, 2012

I have to write a trigger on a table which contain lot of parameters.But i need to pick a specific row and check that without disturbing other stuffs.Is there a way to write Before update trigger on a particular rows filtering the unneccasary rows.

The requirement is when user update the date from front end (Java application) the trigger should check the date and validate that it should be month end date. For example.

1)04/21/2012 wrong date
2)04/30/2012 correct date
3)03/29/2012 Wrong date
4)03/31/2012 correct date

View 7 Replies View Related

SQL & PL/SQL :: Merge Is Not Working Properly?

Apr 23, 2013

I am using the following merge statement it's not working properly. If I tried to insert (or) update the existed record. I am getting unique key constraint violated error.

DECLARE
p_buid NUMBER;
p_ordernum NUMBER;

[Code].....

View 12 Replies View Related

SQL & PL/SQL :: Cursor Not Working Properly?

Nov 29, 2011

I'm trying to Create a procedure that generates:
Customer
Description of Order
Amount of Order
Total Of Order

As this Generates More than One Row I thought i would need to use cursor in order to store the results and then use them from the object So this is what i Coded:

CREATE OR REPLACE PROCEDURE UP_CustOrders
AS
/*I Am Selecting A Cursor Cause It Return More Than One Row*/
CURSOR ReportCursor IS
SELECT Company

[code]..

It appears It creates the procedure but im not sure why it has compilation errors Perhaps im missing some symbols? Here are the tables:

CREATE TABLE Customers
(CustNum NUMBER(10) NOT NULL,
Company VARCHAR2(20) NOT NULL,
CustRep NUMBER(10),

[code]...

View 12 Replies View Related

PL/SQL :: DML Triggers Not Working Properly?

Jul 18, 2013

There are two servers A and B ,and i am maintaining one table suppose table1 and another table suppose table2 , DML triggers are made for both of these tables.The action of DML trigger is that the movement we are inserting values , suppose a table1 on server A so automatically the same set of value in table2 on server Bso my problem is that the movement i inserted value on table1 on server A ,

the same set of values were inserted into table2 of server B and as the values were inserted intotable2 , the same set of values were inserted into the tabld1 because of the trigger.  How to stop the non ending loop which occurs due to the simultaneous firing of triggers and insertion of same records into both the table endlessly...

version :---Personal Oracle Database 10g Release 10.2.0.3.0 TNS for 32-bit Windows: Version 10.2.0.3.0

View 0 Replies View Related

SQL & PL/SQL :: WITH Clause Not Working Properly?

Nov 8, 2010

It seems some issue with With Clause along with Row Number. Output is strange when it comes with SELECT MIN()... But Looks fine Once you add "order by" or "where" clasue inside WITH Clause

SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE 10.2.0.5.0 Production

[code]....

But Output looks fine once you add ORDER By clause inside WITH clause

SQL> WITH EM AS
2 (
3 SELECT EMPNO, ROWNUM RN
4 FROM SCOTT.EMP T ORDER BY ROWNUM

[code]....

why it happens ?

View 4 Replies View Related

How To Verify Serverside TAF Working Properly

Apr 22, 2009

#service setup:

$ srvctl add service -d dc1ext -s addval.dc1 -r "dc1ext1" -a "dc1ext2" -P BASIC
$ srvctl start service -d dc1ext -s addval.dc1

begin
DBMS_SERVICE.MODIFY_SERVICE(
service_name=>'addval.dc1',
aq_ha_notifications => true,
failover_method=>DBMS_SERVICE.FAILOVER_METHOD_BASIC,
[code]......

my attempt at verifying the TAF is working.

SQL> run
1 SELECT MACHINE, FAILOVER_TYPE, FAILOVER_METHOD, FAILED_OVER, COUNT(*)
2 FROM GV$SESSION
3* GROUP BY MACHINE, FAILOVER_TYPE, FAILOVER_METHOD, FAILED_OVER

MACHINE FAILOVER_TYPE FAILOVER_M FAI COUNT(*)
---------------------------------------------------------------- ------------- ---------- --- ----------
anetapp02.dc2 NONE NONE NO 10
anetapp01.dc2 NONE NONE NO 10
app02.st2 NONE NONE NO 5
racdb02 NONE NONE NO 44
anetapp03 NONE NONE NO 10
anetapp04 NONE NONE NO 10
GNOME\APTSEA-6GKJHF1 SELECT BASIC NO 3
app01.st2 NONE NONE NO 5
anetapp05 NONE NONE NO 10
anetapp01 NONE NONE NO 10
anetapp03 NONE NONE NO 10

so it looks as thought the sessions are failing over, but my app guy says he get a few errors during the process.. i need it setup to move the current query over without returning an error.. do i not have this setup properly?

View 3 Replies View Related

Forms :: Tree Hierarchy - Not Working Properly?

Apr 8, 2009

i have created a tree hierarchy....when the user clicks on any node,that particular form will open....But there is some problem...i click on form A,it opens.,...then i exit that form via a exit button on the toolbar....and then I click on form B on the tree....but first the form A only opens...and then again i exit form A, then form B will open..

i have written the following code in when_tree_node_selected trigger :

if condition then
call_form(path,no_hide,do_replace);

View 3 Replies View Related

Performance Tuning :: Hint Is Not Working Properly

Jul 14, 2010

I have a query with FULL hint that is behaving in a strange manner. The query fetches around 700000 of data. Sometimes it fetches the data with the hint and sometimes it does not fetch any data with the hint and then I have to remove the hint and have to fetch the data. Below is the query,

select /*+ FULL(COMP_TM) FULL(TRANS_TM) FULL(INVC_TM) */
CUST_BE_ID ,
DISTR_BE_ID ,
FG_BE_ID ,
KIT_BE_ID ,
BG_ID_NO_BE_ID ,
[code]....

The statistics gathering activity of FACT_DLY_ALGND_SLS table takes around 5 hours to complete. It is a range partitioned table with subpartitions.

View 14 Replies View Related

Server Administration :: CPU Patch Not Working Properly?

Feb 10, 2009

I applied the Jan 09 CPU to my database this past Saturday and now my daily schema export is not running properly:

With the Partitioning, OLAP, Data Mining and Real Application Testing optionsExport done in WE8MSWIN1252 character set and UTF8 NCHAR character set server uses UTF8 character set (possible charset conversion)

About to export specified users ...
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user TEST
. exporting PUBLIC type synonyms
. exporting private type synonyms

[code]...

View 8 Replies View Related

PL/SQL :: Up And Down Arrow Keys Not Working Properly When Using SQL CLI On Linux?

Feb 27, 2013

Every time I hit up, down, left, and right arrow keys to return to a previous sql command I got ^[[D, fix this issue? The backspace works fine with me.

View 2 Replies View Related

Forms :: (Drag And Drop) Not Working Properly?

Jun 6, 2013

I created one Form manually. how to Drag and drop from items in Data Blocks to Canvas. when I created text in Canvas it was automatically creating the item in Data block. but when i create the items in Data blocks and then trying to copy to canvas.

View 1 Replies View Related

SQL & PL/SQL :: Multiple Row Insert Not Working - Command Not Properly Ended

Mar 7, 2013

The multiple row insert is not working

CREATE TABLE example (
example_id INT NOT NULL,
name VARCHAR( 50 ) NOT NULL,
value VARCHAR( 50 ) NOT NULL,
OTHER_VALUE VARCHAR( 50 ) NOT NULL
);

For the below query its showing error .

INSERT INTO example
VALUES
(100, 'Name 1', 'Value 1', 'Other 1'),
(101, 'Name 2', 'Value 2', 'Other 2'),
(102, 'Name 3', 'Value 3', 'Other 3'),
(103, 'Name 4', 'Value 4', 'Other 4');

the error message is.

Error starting at line 1 in command:
INSERT INTO example
VALUES
(100, 'Name 1', 'Value 1', 'Other 1'),
(101, 'Name 2', 'Value 2', 'Other 2'),
(102, 'Name 3', 'Value 3', 'Other 3'),
(103, 'Name 4', 'Value 4', 'Other 4')
Error at Command Line:3 Column:39
Error report:
SQL Error: ORA-00933: SQL command not properly ended
00933. 00000 - "SQL command not properly ended"
*Cause:
*Action:

View 8 Replies View Related

Forms :: Loop Is Not Working Properly - Cannot Save All Records

Oct 11, 2010

here i m giving the code

DECLARE
TYPE SUBNO_TABLE_TYPE IS TABLE OF
TRANS_DEICMAIN1.SUBNO%TYPE
INDEX BY BINARY_INTEGER;
SUBNO_TABLE SUBNO_TABLE_TYPE;
K NUMBER := 1;
S NUMBER := 1;
[code]...

HERE CHECK1 IS A CHECKBOX.WHEN I AM USING THIS CODE ONLY ONE RECORD IS SAVED AT A TIME INSTEAD OF SAVING ALL RECORDS.

View 2 Replies View Related

Forms :: Menu Tree Not Working Properly - Change It?

Feb 12, 2010

I have a form in which menu tree is populated with this sql

SELECT 1, Level, MenuLabel, MenuName, MenuId
FROM MenuFile
CONNECT BY PRIOR MenuId = ParentId START WITH menuId = :moduleid||'0000'

The result is attached in the CSV file enclosed in sheet mrnufile1As we can see in row 3 the item LPC has menuid BDME13.
In my view This item should be in ROW 19.How can i change query do get the desired the result.I have also tried another sql query.

select * from menufile where applicationid = 'BD' order by parentid,menuid

Result of this query is in 2nd Half of CSV file

View 2 Replies View Related

Application Express :: Interactive Report Search Not Working Properly?

Jun 12, 2013

I am using Apex 4.2, The Interactive report Search is not working properly, when i am entering complete date or time it is not showing any results...how to increase performance of the search...

View 5 Replies View Related

SQL & PL/SQL :: Invoking Statement Inside The Trigger Body

Jan 11, 2012

I need to find out the exact DML statement which invoked a particular trigger inside a trigger body.

View 7 Replies View Related

Server Administration :: Complete Content Of Trigger Body In User Triggers

Aug 2, 2010

Column Trigger_body in table user_trigger is long data type.I want to find out the certain 'table name' was using intrigger.

Below is my sql statement:
select trigger_name
from user_triggers
where TRIGGER_BODY like '%tb_test%' or TRIGGER_BODY like '%TB_TEST%';

then it show me a error :
where TRIGGER_BODY like '%tb_test%'
*
ERROR at line 3:
ORA-00932: inconsistent datatypes

I had set long 32767 before execute above statement

View 7 Replies View Related

How To Write Trigger In Oracle 10g

Apr 12, 2011

I am using SQL*Plus to run this Oracle10g. Here is my problem I have to solve: After a new record is added to the task table, write a trigger that reports the new project balance to the user while updating the customer balance to reflect this additional task cost. Insert a new record to show the trigger works. I somewhat understand triggers,I think I have to combine tables to solve this. Here are my tables/attributes I can use to solve it:

CREATE TABLE customer
(
custnoNUMBER(3)CONSTRAINT ccustpk NOT NULL PRIMARY KEY,
custname CHAR(20) CONSTRAINT ccustnamenn NOT NULL,
phone CHAR(12),
curr_balance NUMBER(9,2) CONSTRAINT ccustbalancenn NOT NULL

[code]...

View 8 Replies View Related

SQL & PL/SQL :: Write A Trigger To Validate V_status For Each ID

Dec 30, 2010

I want to write a trigger to validate the v_status for each ID. below is the example

SEQ_NO ID V_STATUS

11 C
21 C
31 F
42 C
52 F
63 C
7 3 F
8 3 C

For each unique id there will be only one F .. if some one tries to update the 2nd F to the same ID it will show the error message that ID is already F.

SEQ_NO ID V_STATUS

11 C
21 C
31 F
42 C
52 F
63 C
7 3 F
8 3 F

View 12 Replies View Related

Forms :: Write Trigger To Insert System Clock Time In Oracle?

Jan 4, 2013

how can i write a trigger to insert the system clock time in the oracle form?

View 15 Replies View Related

SQL & PL/SQL :: DDL Trigger Not Working?

May 14, 2013

I have a trigger to automate grants to a Role whenever a table is created in my schema.I have dba rights.

CREATE OR REPLACE PROCEDURE deepa.myddl
(p_ddl IN VARCHAR2) IS
BEGIN
EXECUTE IMMEDIATE p_ddl;

[Code].....

This works perfectly when i create a table as deepa user. But say when another User creates a table in my schema

like create table deepa.test1 ( a number) This trigger is not fired. Whenever a table is created by me or by any other user in my Schema, i need the trigger to be fired.

View 2 Replies View Related

Cursor In Trigger Not Working?

Dec 25, 2011

i have a problem with Cursor in trigger,

CODEcreate or replace trigger admin
                  after insert on admin
                  for each row
                  declare
                   bang varchar2(250):='ADMIN';  
                  
[code]...

i will try with select :new.i.column_name from dual, but not run (because i can't determination exactly column name thus i must use column_name variable)

View 6 Replies View Related

SQL & PL/SQL :: Create Trigger Not Working For Auto-increment

Jun 16, 2010

Step1

CREATE TABLE test
(id NUMBER PRIMARY KEY,
name VARCHAR2(30));

Step2

CREATE SEQUENCE test_sequence
START WITH 1
INCREMENT BY 1;

Method1 Follow Step1 and Step2 and create a Trigger as below :

CREATE OR REPLACE TRIGGER test_trigger
BEFORE INSERT
ON test
REFERENCING NEW AS NEW
FOR EACH ROW
BEGIN
SELECT test_sequence.nextval INTO :NEW.ID FROM dual;
END;
/

Method 2 Follow Step1 and Step2 and directly have an insert statement as below:

INSERT INTO test (id, name) VALUES (test_sequence.nextval , 'Jon343');

Method 1, the Trigger is not getting created, however by following Method 2, I am able to generate auto-increment number.

View 8 Replies View Related

SQL & PL/SQL :: Function That Returns A Table Type Inside A Package Body

Jul 26, 2011

CREATE OR REPLACE TYPE TEST_OBJ_TYPE IS OBJECT
(
TEST_ID NUMBER(9),
TEST_DESC VARCHAR(30)
)
/
CREATE OR REPLACE TYPE TEST_TABTYPE AS TABLE OF TEST_OBJ_TYPE
/
[code]....

I need to include the above function in a plsql package. How I can declare a object type and table type in a pks file? the syntax to include the above code in a .pks and .pkb file?

I got this code snippet online when I was looking for function that returns a table type. what exactly that Exception block does? delete the table when there is an exception, otherwise return the table type?

View 10 Replies View Related

SQL & PL/SQL :: Insert Into Table - Command Not Properly Ended

Oct 23, 2012

INSERT INTO Table (NID, NType) SELECT DTreeNotifySequence.NextVal, 1 FROM Dee WHERE ID =354344 commit;

I get the following error:

ORA-00933: SQL command not properly ended

I tried it in several ways...are more semicolons needed?

View 4 Replies View Related

SQL & PL/SQL :: Update Table With Join / ORA-00933 / Command Not Properly Ended

Jan 18, 2013

I'm unable to get the below update SQL to run in Oracle, it's giving me th below error

ORA-00933: SQL command not properly ended.

UPDATE
PDR.PH_Family_Match_by_Chassis a
SET a.Launched = 'Y'
INNER JOIN
PDR.domCHASSIS
ON
a.chassis_id = PDR.domCHASSIS.chassis_id

[code]....

View 8 Replies View Related

SQL & PL/SQL :: How To Write Query To Convert XML To Table

Oct 15, 2012

I have table xx_xml_test m which have row single entry

<logentry
revision="3">
<author>MA111300</author>
<date>2012-10-03T12:42:40</date>
<paths>
<path
[code].......

i want convert the table like below

Revision author date kind action path
3 MA111300 2012-10-03 12:42:40 file A /root.txt
3 MA111300 2012-10-03 12:42:40 file A /sample2/test_2.txt

View 2 Replies View Related

SQL & PL/SQL :: Write A Query In Order To Receive A New Table?

Apr 23, 2012

i need to write a query in order to receive a new table.

select table_name,col1, null col2
from
(SELECT b.table_name, b.col1 col1, a.CountPrimaryKeys
from
(SELECT user_constraints.table_name,
COUNT(user_cons_columns.column_name) CountPrimaryKeys

[code].......

View 21 Replies View Related







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