random fetch using cursor
Posted:
Fri Apr 01, 2011 8:08 pm
by aruljyothii
i want to select a row randomly from my table using primary key..... can any one help me in this with with query..... pls...
Re: random fetch using cursor
Posted:
Fri Apr 01, 2011 8:18 pm
by enrico-sorichetti
no until You explain better the requirement
review the SELECT WHERE syntax to realize that what You ask for is quite awkward!
Re: random fetch using cursor
Posted:
Mon Apr 04, 2011 7:17 pm
by aruljyothii
my table looks like as follows.
creat table qbank
( qno numeric(2),
mid char(5),
qtext varvhar(160),
ch1 varchar(30),
ch2 varchar(30),
ch3 varchar(30),
ch4 varchar(30),
tqlevel char(1)
)
where qno = question number,
mid = module id,
qtext = question,
ch1 = choice 1,
ch2 = choice 2,
ch3 = choice 3,
ch4 = choice 4,
tqlevel = question mark
From this table i want to fetch random questions from a particular module. not in sequence. using cursors.... can anyone help me in this with a example query...
Re: random fetch using cursor
Posted:
Mon Apr 04, 2011 7:37 pm
by Akatsukami
Is qno unique over all, or only within mid? What language do you intend to embed your SQL in?