MINERVA superseeded IF/Prolog.
Please see
http://www.ifcomputer.co.jp/MINERVA
for details.
We discontinued to sell IF/Prolog Dec 31. 2003.
For current customers, we continue to provide
professional support for IF/Prolog until Dec 31, 2008.
run(TList) :-
float_format(_,f(5,2)), oracle_logon('scott/tiger',R1),
(R1==0;R1 ==0,write(' n** logon failed ** n'),abort),
oracle_auto_off(_), drop_supplier_table,
make_supplier_table,
query_supplier_table(-1,TList).
drop_supplier_table :-
oracle_exec('drop table supplier',R).
(R==0;R ==0,write(' n** table not removed ** n'),abort).
make_supplier_table :-
concat( 'SName char(10)','IName char(20)','NumSold number',
'Price number(6,1)' ,',',TARGS),
create_table(supplier,TARGS,R1),
(R1==0;R1 ==0,write(' n** table create failed ** n'),abort),
%% backtrack point:
supplier(SN,IN,NS,PR),
quotestring(SN,QSN), quotestring(IN,QIN),
concat( QSN,QIN,NS,PR ,',',ARGS),
insert_table(supplier,ARGS,R2),
(R2==0,fail;R2 ==0,write(' n** table fill failed ** n'),abort).
make_supplier_table.
query_supplier_table(NTup,TList) :-
write(' nquerying: what items cost more than $1000 ?'),
concat( 'select IName, Price from supplier ',
'where Price > 1000' , Q_QUERY),
oracle_fetch_n(Q_QUERY,NTup,TList).
create_table(TName,ARGS,R) :-
concat( 'create table ',TName,' (',ARGS,' )' , Q_CREATE),
oracle_exec(Q_CREATE, R).
insert_table(TName,ARGS,R) :-
concat( 'insert into ',TName,' values (',ARGS,' )' , Q_INSERT),
oracle_exec(Q_INSERT,R).
quotestring(S,QS) :- concat( ' '',S,' '' ,QS).
supplier(dior,nice_watch,100,550.0).
supplier(dior,porsche_glasses,80,498.0).
supplier(dior,brillant_jewel,4,2990.0).
supplier(dior,silver_hat,14,1480.0).
!R! UNIT C;SLS .4;EXIT; supplier(tiffany,golden_ring,20,299.0).
supplier(tiffany,ruby_jewel,20,1500.0).
supplier(tiffany,nice_watch,50,1050.0).
supplier(tiffany,silver_diadem,3,12490.0).
supplier(cartier,beuys_hat,14,17480.0).
supplier(cartier,nice_watch,100,550.0).
supplier(cartier,lady_di_collar,1,25450.0).
|