
procedure print_emp_record(Id in integer) is
Rec emp%rowtype;
begin
if id is not null then
select * into Rec from emp where id = Id;
htp.print('Id: ' || Rec.id);
htp.print('Name: ' || Rec.name);
...
else
htp.print(htf.bold('Unable to retrieve record!'));
end if;
end;
einfache Einbettung von SQL-Kommandos, Cursor-Konzept fr Mengen
z. T. ungenaue Fehlermeldungen des Compilers
procedure create_form(Title in varchar2 default null) is
begin
htp.formOpen('form_response');
htp.preOpen;
htp.formHidden('Cookie','something hidden');
htp.p(htf.bold('Name ' || htf.formText('Name'));
htp.p(htf.bold(htf.formSubmit('Action','Add')));
htp.p(htf.bold(htf.formSubmit('Action','Delete')));
htp.preClose;
htp.formClose;
end;
erstellen eines forms, POST-Methode default, versteckte Felder für Status-Übergabe
procedure form_response(Cookie in varchar2 default null, Name in varchar2 default null, Action in varchar2 default null) is
begin
htp.preOpen;
htp.p(htf.bold('Name: ' || Name));
htp.p('Action: ' || Action);
htp.preClose;
end;
Parameter müssen exakt übereinstimmen
http://info.sbg.ac.at:6711/ows-bin/usg/owa/auth?
function has_tables return boolean is
begin
get_state_if_needed;
if st.http_user_agent like 'Mozilla%' or
st.http_user_agent like '%PowerBrowser%' or
st.http_user_agent like 'Enhanced_Mosaic/2.1%' or
st.http_user_agent like 'NCSA_Mosaic%' then
return true;
end if;
return false;
end;
function fontup(x varchar2) return varchar2 is
begin
if st.http_user_agent like 'Mozilla%' then
return tru.html('font size=+2') || substr(x,1,1) || tru.html('/font') || substr(x,2);
else
return x;
end if;
end;
procedure dbimage ( iid in varchar2) is
this_image varchar2(32760);
begin
this_image := image.get(to_number(iid));
owa_util.mime_header('image/jpg');
htp.prn(this_image);
exception
when others then
tru.die('tru.db_image',sqlerrm);
end;
end;
procedure page_count is
delta number;
cdelta varchar2(32);
begin
cnt := tx.cnt(me);
htp.para;
if cnt = 0 then
htp.p(message.msg(88));
else
htp.p(message.msg(89) || to_char(cnt) || message.msg(90));
end if;
if cnt > 0 then
xx := tx.last(me);
htp.para;
delta :=sysdate-xx.timestamp;
if delta <= 1/24/60 then
cdelta := to_char(delta*24*60*60,'90.0') || message.msg(91);
elsif delta <= 1/24 then
cdelta := to_char(delta*24*60,'90.0') || message.msg(92);
elsif delta <= 1 then
cdelta := to_char(delta*24,'90.0') || message.msg(93);
else
cdelta := to_char(delta,'9990.0') || message.msg(94);
end if;
htp.p(message.msg(95) || to_char(xx.timestamp,'dd-Mon-yy hh24:mi:ss') || message.msg(96) || cdelta || message.msg(97));
end if;
if cnt > 0 then
page_stats;
end if;
end;
English, Language=1
insert into message_data (id,lang_id,msg) values
(1,1,'Welcome to Oracle Travel');
insert into message_data (id,lang_id,msg) values
(2,1,'Image of a train');
...
Swedish, Language=2
insert into message_data (id,lang_id,msg) values
(1,2,'Välkommen till Oracle Travel');
insert into message_data (id,lang_id,msg) values
(2,2,'En bild av ett tåg');
...