Hi all Is there a SQL command that searches for a search term in a record? (not in a single field) /Franz |
There is no scalar function like STRING ( record ), but there is an UNLOAD INTO VARIABLE, so depending on how badly you want to do this, the following code lets you search "SELECT *" without naming every column... (note that it does not name the column proc_defn which is where the LIKE is finding its matches) BEGIN DECLARE @rowstring LONG VARCHAR; FOR f_fetch AS c_fetch INSENSITIVE CURSOR FOR SELECT SYSPROCEDURE.proc_id AS @proc_id, SYSPROCEDURE.proc_name AS @proc_name FROM SYSPROCEDURE ORDER BY SYSPROCEDURE.proc_id FOR READ ONLY DO UNLOAD SELECT * FROM SYSPROCEDURE WHERE proc_id = @proc_id INTO VARIABLE @rowstring; IF @rowstring LIKE '%systab%' THEN MESSAGE STRING ( @proc_name ) TO CONSOLE; END IF; END FOR; END; sa_conn_info sp_objectpermission sp_columns sp_fkeys sp_pkeys sp_special_columns sp_statistics col_length index_col sa_validate sa_table_stats ... Ok, thank you very much. /Franz
(06 Apr '19, 06:55)
Franz_Stf
|
I guess this would work. But maybe you have to tweak it a little bit to match your needs create or replace function usr.RowContains(in in_TableName varchar(64),in in_RecordId integer,in in_SearchFor varchar(256)) |
Probably not what you want, but... WHERE col1 LIKE '%whatever%' OR col2 LIKE '%whatever' WHERE STRING ( col1, col2 ) LIKE '%whatever' ...or, Full Text Search. |
i mean: WHERE STRING ( Record ) LIKE '%whatever'
/Franz