Mohamed Houri’s Oracle Notes

August 6, 2011

Special Merge

Filed under: Oracle — hourim @ 3:50 pm

An interesting question came up on the otn thread ( http://forums.oracle.com/forums/thread.jspa?messageID=9772504&#9772504) a couple of days ago. The original poster was asking on how to avoid superfluous updates when using the MERGE command. He said that he wants the update to start only if one of the columns to be matched has been changed; otherwise he would like the update to be ignored by the MERGE command when a matching key has been found.

I included my answer within the thread. How, in your case, would you proceed to accomplish the original poster requirement?

Advertisements

On the use of dbms_metadata.get_ddl

Filed under: Oracle — hourim @ 3:48 pm

A question recently came into an oracle French forum (http://www.developpez.net/forums/d1117051/bases-donnees/oracle/source-vue-format-text/)  asking about how to get a DDL of views containing a given text

I thought it is worth writing here the English translation of my French answer to that thread. I will start by creating a view in which I will use the term ‘Mohamed’


mhouri.world> create view view_test as
2  select *
3  from emp
4  where ename = 'Mohamed';
View created.

And now we would like to get views that contains the text ‘Mohamed’ in their DDL creation script.


mhouri.world> SELECT *
2    FROM
3    (SELECT
4           dbms_metadata.get_ddl('VIEW', view_name) txt
5     FROM  user_views
6    ) ww
7  WHERE
8     dbms_lob.instr (ww.txt, 'Mohamed') != 0
9  ;

CREATE OR REPLACE FORCE VIEW "MHOURI"."VIEW_TEST" ("EMPNO", "ENAME", "JOB", "MGR
", "HIREDATE", "SAL", "COMM", "DEPTNO") AS
select "EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO"
from emp
where ename = 'Mohamed'

Hope this will help.

Create a free website or blog at WordPress.com.

Tony's Oracle Tips

Tony Hasler's light hearted approach to learning about Oracle

Richard Foote's Oracle Blog

Focusing Specifically On Oracle Indexes, Database Administration and Some Great Music

Hatem Mahmoud Oracle's blog

Just another Oracle blog : Database topics and techniques

Mohamed Houri’s Oracle Notes

Qui se conçoit bien s’énonce clairement

Oracle Diagnostician

Performance troubleshooting as exact science

Raheel's Blog

Things I have learnt as Oracle DBA

Coskan's Approach to Oracle

What I learned about Oracle

So Many Oracle Manuals, So Little Time

“Books to the ceiling, Books to the sky, My pile of books is a mile high. How I love them! How I need them! I'll have a long beard by the time I read them”—Lobel, Arnold. Whiskers and Rhymes. William Morrow & Co, 1988.

EU Careers info

Your career in the European Union

Carlos Sierra's Tools and Tips

Tools and Tips for Oracle Performance and SQL Tuning

Oracle Scratchpad

Just another Oracle weblog

OraStory

Dominic Brooks on Oracle Performance, Tuning, Data Quality & Sensible Design ... (Now with added Sets Appeal)