Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 23rd, 2004, 02:10 PM
banzai banzai is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 4 banzai User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
[ delete please ]

I wrote the following trigger to alter the inserted data:

BEFORE INSERT ON PROPERTY
REFERENCING NEW AS nr
FOR EACH ROW
BEGIN
IF ( LENGTH ( RTRIM ( :nr.PROPERTY_DESCRIPTION ) ) < 0 ) THEN
TRANSLATE ( :nr.PROPERTY_DESCRIPTION, ' ', '0');
END IF;
END;
/

the same syntax works fine in sqlldr to replace blanks with 0's but trigger code fails.

Errors for TRIGGER INSERT_PROPERTY:

LINE/COL ERROR
-------- -----------------------------------------------------------------
3/12 PL/SQL: Statement ignored
3/12 PLS-00221: 'TRANSLATE' is not a procedure or is undefined

Reply With Quote
  #2  
Old September 23rd, 2004, 04:24 PM
shammat shammat is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Oct 2003
Location: Munich, Bavaria
Posts: 1,007 shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 13 h 57 m 43 sec
Reputation Power: 67
First: I don't think your IF statement will ever return true, because I cannot image a situation where the length of an String would be lower then zero (or did you mean > 0)

Second, I guess you need to write:
Code:
:nr.PROPERTY_DESCRIPTION = TRANSLATE ( :nr.PROPERTY_DESCRIPTION, ' ', '0')
It's been a while since I wrote my last Oracle trigger, but as far as I can remember you have to assign the return value of your function call to something.

Reply With Quote
  #3  
Old September 24th, 2004, 12:42 AM
banzai banzai is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 4 banzai User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by shammat
First: I don't think your IF statement will ever return true, because I cannot image a situation where the length of an String would be lower then zero (or did you mean > 0)

Second, I guess you need to write:
Code:
:nr.PROPERTY_DESCRIPTION = TRANSLATE ( :nr.PROPERTY_DESCRIPTION, ' ', '0')
It's been a while since I wrote my last Oracle trigger, but as far as I can remember you have to assign the return value of your function call to something.


Yes I figured that out, the problem was with asignment

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > ORACLE TRIGGER question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT