Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Didattica > Corsi A - F > Basi di dati ~ informatica triennale > Domanda trigger
  Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
Cic
.fedelissimo.

User info:
Registered: Jul 2009
Posts: 44 (0.01 al dì)
Location:
Corso:
Anno:
Time Online: 16:21:01: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
Domanda trigger

CREATE OR REPLACE FUNCTION f1 RETURNS boolean AS $$
DECLARE

r boolean;
x1 correntista.max_prelievo%TYPE;
x2 prelievo.prelievo TYPE;
c1 CURSOR FOR SELECT prelievo FROM prelievo WHERE idcorrentista=$1;

Ciao a tutti, sottopongo alla vostra attenzione il seguente trigger. E' un quesito di un tema d'esame del 2004, al quale si deve scegliere la risposta corretta tra queste 4:

A) f1 restituisce error se il correntista $1 non è presente nella base dati.
B) f1 restituisce error se il correntista $1 non ha prelevato somme.
C) f1 restituisce true se il correntista $1 ha prelevato somme non superiori
a max_prelievo.
D)f1 restituisce false se il correntista $1 non ha prelevato somme.

Vorrei sapere se anche secondo voi la risposta esatta è la D.

BEGIN
SELECT max_prelievo INTO x1 FROM correntista WHERE correntista=$1;
r=false;
OPEN c1;
LOOP
FETCH c1 INTO x2;
IF NOT FOUND THEN
EXIT;
END IF;
IF x1>x2 THEN
RETURN r;
END IF;
END LOOP;
CLOSE c1;
r=true;
RETURN r;
END;

13-06-2015 16:12
Click Here to See the Profile for Cic Click here to Send Cic a Private Message Find more posts by Cic Add Cic to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 14:37.    Post New Thread    Post A Reply
  Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.030 seconds (66.56% PHP - 33.44% MySQL) con 28 query.