vrijdag 19 juli 2013

Oracle 12c: deprecated xml update functions

All Oracle SQL functions for updating XML data are deprecated. Oracle recommends that you use XQuery Update instead. These are the deprecated XML updating functions:
    updateXML
    insertChildXML
    insertChildXMLbefore
    insertChildXMLafter
    insertXMLbefore
    insertXMLafter
    appendChildXML
    deleteXML

Old way:
set serveroutput on;
DECLARE
   myMainXml   XMLTYPE;
   mySubXml    XMLTYPE;
   myCombinedXml XMLTYPE;
   
BEGIN
   SELECT   XMLELEMENT ("MAIN", NULL) INTO myMainXml FROM DUAL;
   SELECT   XMLELEMENT ("SUBXML", 'Some value') INTO mySUBXml FROM DUAL;
   
   SELECT   APPENDCHILDXML(myMainXml, '/MAIN',mySUBXml)INTO myCombinedXml FROM DUAL;
   
   dbms_output.put_line(myCombinedXml.getclobval ()); 
   
END;

new way:
set serveroutput on;

DECLARE
   myMainXml       XMLTYPE;
   mySubXml        XMLTYPE;
   myCombinedXml   XMLTYPE;
BEGIN
   SELECT   XMLELEMENT ("MAIN", NULL) INTO myMainXml FROM DUAL;

   SELECT   XMLELEMENT ("SUBXML", 'Some value') INTO mySUBXml FROM DUAL;

   SELECT   XMLQUERY ('copy $tmp := . modify insert node  $bla  as last into $tmp/MAIN return $tmp'
               PASSING myMainXml,  mySubXml as "bla"  RETURNING CONTENT)
     INTO   myCombinedXml
     FROM   DUAL;


   DBMS_OUTPUT.put_line (myCombinedXml.getclobval ());
END;

woensdag 29 april 2009

How to prepare for the ZCE PHP5 exam

Last week I passed the Zend PHP5 exam, and became a ZCE (Zend certified engineer)
Since it was quite a lot of work to prepare for the exam, I thought it might be a good idea to write down what I did to prepare for the exam.

First of all, you have to prepare very well for the exam, if you think you already know PHP, well, you might have to think again. I'd been working with PHP for about 5 years, so I thought I knew PHP well enough, but I found out that there was still a lot I didn't know yet.
So here's what worked for me:
  • Study the PHP manual, especially the chapters about string functions and arrays, memorize all those functions very well.
  • I bought The book "php|architect's Zend PHP 5 Certification Study Guide" by by Davey Shafik and Ben Ramsey . It's a great start, but don't think you're ready when you've read the book, you'll have to study more to get more information on the topic the book touches. You can get the book here .
  • Buy the practise exams from php|architect, they're a great help to see where you stand and if you've studied enough. One word of warning thought: there's a quite anoying thing about these practise exams, they will not tell you what questions you did wrong (or what their right answers would have been), you only get a overview of what topics you passed and which you failed. To get more use out of these practise exams, I downloaded a screenshot tool, and took a screenshot of every question that I wasn't sure about or didn't know. That way I could look for information afterwards.
    If you want to pass the real exam, you have to make sure you get a overall "excelent" score, and you shouldn't fail on any of the subject.
    Be carefull with doing too much practise exams, because you might end up memorising the practise exam's questions. (The real exam was harder than the practise exam by the way)
  • As said before, the Certification Study Guide isn't enough to pass the exam, browse the internet for tutorials about subjects you don't know enough about, and play with the code. I've found these tutorials very useful:
    Introduction To PHP Sessions

    Introduction to PHP PDO
    XML in PHP 5 - What's New?
    Design Patterns
    Introduction To SimpleXML With PHP
    Introduction to SPL
    MySQLi (dutch)
    PHP Bitwise Tutorial
  • I found this test exam quite useful, it will give you 10 random questions. There are some weird questions in there, but most of theme are a good practice.
  • The ZCE exam will throw a lot of tick questions at you, you'll have to know what things like this do: echo 5 . print(4); (the answer is 451, now go figure out why :P )
  • Browse the internet for more blogs like this one, there are quite a lot around :)
Well, that's it. Be aware that this is what got me passing the exam, but every exam is different, so don't blame me if you still fail :P

Good luck!