RE: [Q] Select Problem
Posted in 1998
Topics: Stored Procedures & SPL
Hello Pawel,
{
The Problem.............
Hi,
anyone know , how to get similar functionality for numerical as LIKE
does for string.
I am developing program which has common frame to select records ,
restricted by user input . When user types in 'A*' all records
begining
with A will be displayed.
But what if field is not of text type ? How to display records
begining
with 5 ?
please help {I'll try}
}
The answer????
Here is a very simple way for what you want to do.
Its basic, but it works.......
SELECT * FROM a_table
WHERE a_field = 5
OR a_field/10=5
OR a_field/100=5
OR a_field/1000=5
OR a_field/10000=5
OR a_field/100000=5
OR a_field/1000000=5
OR a_field/10000000=5
OR a_field/100000000=5
OR a_field/1000000000=5
the above will work for intger or serial fields.
If you want to search on a smallint, use the select below....
SELECT * FROM a_table
WHERE a_field = 5
OR a_field/10=5
OR a_field/100=5
OR a_field/1000=5
OR a_field/10000=5
Good Luck
Jamie
jamie@cim.co.uk
jamie.nash@ark.uk.com
www.ark.uk.com
and so on......
--
Pawel Stepniowski
mailto:stepniow@quantum.pl
internet: http://www.quantum.de/~pawel
<<File: [Q] Select Problem.TXT>>
.......................................................................
Item Subject: WINMAIL.DAT
Could not convert Microsoft Mail Message Data item to text.
Will attempt to 'shar' item as file '000o4hm' at end of msg.
# This is a shell archive. Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by openmail at cim0 on Thu Apr 9 10:47:26 1998
#
# This archive contains:
# 000o4hm
#
echo Compiling unpacker for non-ascii files
pwd=`pwd`; cd /tmp
cat >unpack$$.c <<'EOF'
#include <stdio.h>
#define htoi(c) (c<='9' ? c-'0' : c-'A'+10)
main() {
register int c, c2;
while ((c=getchar())!=EOF) {
if (c=='\\n') continue;
c2 = getchar();
putchar((htoi(c)<<4) + htoi(c2));
}
}
EOF
cc -o unpack$$ unpack$$.c
rm unpack$$.c
cd $pwd
echo x - 000o4hm '[non-ascii]'
/tmp/unpack$$ >000o4hm <<'@EOF'
789F3E22A8B5010690080004000000000001000100010790060008000000E404000000000000E8
0001088007001800000049504D2E4D6963726F736F6674204D61696C2E4E6F7465003108010D80
0400020000000200020001048001001700000052453A205B515D2053656C6563742050726F626C
656D006B0701058003000E000000CE07040009000A002B001C000400370101008000003D000000
04003D000C0021004A616D6965204E61736800004F50454E4D41494C3A4A616D6965204E617368
202F4D49532C434F4F4B48414D000000000000000000830D01208003000E000000CE0704000900
0A002400360004004A010109800100210000004237324337443243393643464431313138433233
30304130323438353338313600030701039006005C010000120000000B00230000000000030026
00000000000B0029000000000003002E000000000003003600000000004000390020341DF39B63
BD011E004200010000000B0000004A616D6965204E61736800004000480020965AF49B63BD011E
007000010000001700000052453A205B515D2053656C6563742050726F626C656D000002017100
010000001600000001BD639BF2D02C7D2CB8CF9611D18C2300A02485381600001E001A0C010000
000B0000004A616D6965204E617368000002011D0C01000000210000004F50454E4D41494C3A4A
414D4945204E415348202F4D49532C434F4F4B48414D000000001E001E0C01000000090000004F
50454E4D41494C000000001E001F0C01000000180000004A616D6965204E617368202F4D49532C
434F4F4B48414D00400007302055FC079B63BD01400008302055FC079B63BD011E003D00010000
000500000052453A200000000003000D34FD3700000B40
@EOF
chmod 660 000o4hm
rm /tmp/unpack$$
exit 0