Özür dilerim soruyu dikkattli okumamışım. araştırma yaptım şöyle bir sonuç çıktı nedir ne değildir denemedim ama.
Select a random row with Firebird:
1) Install ib_udf (comes with the server) or at least the rand() function with this statement:
Kod: Tümünü seç
DECLARE EXTERNAL FUNCTION rand RETURNS DOUBLE PRECISION BY VALUE ENTRY_POINT 'IB_UDF_rand' MODULE_NAME 'ib_udf';
2)Now proceed in selecting a random row from the database:
Kod: Tümünü seç
SELECT FIRST 1 * FROM country ORDER BY rand()
ayrıca firebirdsql.org sayfasında firebird 2.0 ve üstü için rand fonksiyonu yerine srand fonksiyonunu kullanabilirsiniz yazıyor.
rand
Library: ib_udf
Changed in: 2.0
Description: Returns a pseudo-random number. Before Firebird 2.0, this function would first seed the random number generator with the current time in seconds. Multiple rand() calls within the same second would therefore return the same value.
If you want that old behaviour in Firebird 2 and up, use the new function srand().
Kod: Tümünü seç
Result type: DOUBLE PRECISION
Syntax:
rand ()
Declaration:
DECLARE EXTERNAL FUNCTION rand
RETURNS DOUBLE PRECISION BY VALUE
ENTRY_POINT 'IB_UDF_rand' MODULE_NAME 'ib_udf'