Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

As for a plain SQL query, you can write PL/SQL just as you would to run against the database directly - but putting any CenterView expressions in curly braces i.e. starting with a '{' and ending with '}'.

...

Code Block
declare 

...

v_count number;

...

begin

...

	select count (1)
	into v_count
	from INTL_CODES
	where operator = {Operator} and code = {Code};

...

 
	if (v_count = 0)
	then
		insert into INTL_CODES
		values( 

...

{Operator}, 

...

{Code}, 

...

{toDate(StartDate)} 

...

);
	else
		update INTL_CODES set START_DATE = {toDate(StartDate)}

...

		where operator = {Operator} and code = {Code};
	end if;

...


end;

...

In this example we are loading international codes into a database, as in the plain SQL examples. Here, we want to insert a new value if no value already exists in the table for the Operator/Code combination; otherwise we will edit the existing record with the START_DATE of the current value that we have read from the input stream.

...