In PHP I use this code with a prepared statement to insert null in the field
justif_emenda when
the value in the form is an empty string or a string with only spaces. I hope
this will help you.
$sql = "INSERT INTO tbl_emenda ("
. "id_emenda, subtipo_emenda, tipo_emenda, "
. "nome_autor
Dear Lane, is that what you want?
CREATE TABLE network_nodes (
node_id SERIAL PRIMARY KEY,
node_name VARCHAR,
default_gateway_interface_id INTEGER
);
CREATE TABLE router_interfaces (
interface_id SERIAL PRIMARY KEY,
node_id INT REFERENCES network_nodes
);
CREATE VIEW current
> Has anybody done this? If so, can you send me a sample?
CREATE TEMPORARY TABLE fruits (id SERIAL, name TEXT);
INSERT INTO fruits VALUES (DEFAULT, 'banana');
INSERT INTO fruits VALUES (DEFAULT, 'apple');
CREATE TEMPORARY TABLE food (id SERIAL, name TEXT);
INSERT INTO food VALUES (DEFAULT, 'apple'
A function to check for valid integers:
CREATE OR REPLACE FUNCTION retInt(VARCHAR) RETURNS integer AS '
DECLARE
number ALIAS FOR $1;
i INTEGER := 1;
BEGIN
IF ((number IS NULL) OR (number = )) THEN
RETURN NULL;
END IF;
WHILE (i <= length(number)) LOOP
IF ((subs
Using CASE to avoid '':
CREATE TABLE test (number TEXT);
INSERT INTO test VALUES('123');
INSERT INTO test VALUES('a123b');
INSERT INTO test VALUES('');
teste=> SELECT CASE number WHEN '' THEN NULL ELSE
to_number(number,'990') END AS
number FROM test;;
number
123
123
There is the postgresql-8.0.3-1.i386.rpm for Fedora Core 4 in
http://ftp.idilis.ro/mirrors/fedora/core/4/i386/os/Fedora/RPMS/
and others mirrors. I don't know if it works with Fedora Core 2. Probably not.
For Fedora Core 3 there is the postgresql-7.4.6-1.FC3.1.i386.rpm in
http://ftp.idilis.ro/m