Friday, March 20, 2015

How to use Parameter in where clause of oracle cursor

An example of Dynamic where clause in Oracle Cursor

declare
    v_deptnos  varchar2(100) ;
    v_rc       sys_refcursor;
    v_dept_name varchar2(200);
     str_sql varchar2(200);
    begin
       v_deptnos := '10,20';
       str_sql:=' or dept_name=''Accounting'';
       open l_rc for 'select dept_name from dept where deptno in (' || v_deptnos || ')'||str_sql;
     loop
       fetch v_rc into v_dept_name;
       exit when v_rc%notfound;
       dbms_output.put_line(v_dept_name);
    end loop;
      close v_rc;
  end;

Sunday, March 8, 2015

Passing parameters to a procedure executed by Oracle DBMS_SCHEDULER


Passing parameters to a procedure executed by
Oracle DBMS_SCHEDULER



You should first create the job, then define the arguments, and then run it. When you create it, set the enabled attribute to false, so it won't run yet:

For Detail click here

Saturday, November 29, 2014

PHP - XML: Retrieving Attribute Values

Example of XML: Retrieving Attribute Values by PHP


First, create xml document like this:
01<?xml version="1.0"?>
02<datas>
03  <cars>
04    <car>
05      <manufacture country="japan">Honda</manufacture>
06      <type>Honda Jazz</type>
07    </car>
08    <car>
09      <manufacture country="korea">Nissan</manufacture>
10      <type>Nissan Livina</type>
11    </car>   
12  </cars>
13</datas>
Save as "cars.xml" within www/test/xml. Then create reader like this:
01<?php
02$xml = simplexml_load_file("cars.xml")
03       or die("Error: Cannot create object");
04        
05foreach($xml->children() as $cars){
06    foreach($cars->children() as $car => $data){
07      echo $data->manufacture['country'];
08      echo "<br />";
09    }
10}
11 
12?>