Thursday, May 31, 2012

Nice problems

If you like challanges see these problems on StackOverflow:

Rectangles:
http://stackoverflow.com/q/7706664/319875

Resequence items after a delete:

Wednesday, March 21, 2012

Oracle Database Concepts

(If you really search oracle database concepts see the doc from Oracle here)

  • Sinonime: aceeaşi Mărie, cu altă pălărie.
  • Tabelă partiţionată: o singură pălărie, mai multe Marii.
  • Sistemul de drepturi: O Marie se duce la primărie, se intoarce fără hârtie. Normal, daca esti cetatean, poti obţine hârtia de la funcţionar. Totusi rolul generic de cetaţean nu-i de-ajuns, trebuie sa obţii dretpuri specifice, cu interventii unde trebuie. (In Oracle , daca ai obtinut drepturi asupra unui obiect printr-un rol, nu il vezi din proceduri stocate si alte constructii de acest gen. Trebuie sa ai grant specific pe obiectul respectiv.)
  • Acces pe baza de index: te duci la Ion sa iti spuna unde e Maria.
  • Acces pe baza de rowid: O cunosti foarte bine pe Maria.
  • View materializat: Iti e de ajuns si o poză a Mariei.
  • View: N-ai nicio poza, singura solutie e webcam-ul.
  • Synonym translation is no longer valid: A plecat Maria, ai ramas doar cu pălăria.

Tuesday, March 13, 2012

Thursday, January 19, 2012

Analytic functions

Analytic functions are nice:


stackoverflow: Conditional group by (group similar items)

As above, you can group by some rows and others not, in a single shot.

Monday, September 26, 2011

Cum arăţi că iubeşti?

I-a citit Mariei Mary povestirea cu femeia pacatoasa care a plans la picioarele Domnului Isus si care L-a uns cu mir de nard curat.
La sfarsitul povestirii, se cere fedback:
Intrebarea numarul unu: Cum arati tu cuiva ca il iubesti?
Raspunsul Mariei. Păi dacă tati imi cere mie... un prosop, eu îl iau, îl intocmesc frumos, si i-l dau asa frumos... Adica sunt ascultatoare.
Intrebarea numărul doi. Cum arati tu Domnului Isus ca Il iubesti?
Raspunsul Mariei.Pai cand o merg asa prin cer, daca ma intalnesc cu Domnul Isus, si e murdar pe picioare, Il spal pe picioare. Si daca e murdar si pe mâini, Il spăl si pe mâini.

Friday, July 1, 2011

Oracle's minus has a bug?

No, it doesn't.
But look at the following situation:
You have two tables that must be identical(must contain same data).
You shoot a minus between them and get some rows. Few, but they exists.

You choose one row from the result of minus, and run
select * from table1 where col=key1
minus
select * from table2 where col=key1
and you get one row.

you run

select * from table1 where col=key1
union all
select * from table2 where col=key1
and you get two rows.

you run 
select * from table1 where col=key1
union
select * from table2 where col=key1
and you get one row!
so, the rows are not different!

How can that be possible???
You run explain plan for every query from above and it does what you asked in query.
Think a bit, and if you can't find the answer, scroll down to see it.