473,549 Members | 4,476 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

fail to compare between bytea output in


I have a function and am using cursor. All the columns I select in the cursor clause are BYTEA datatype.

I need to compare the after-fetch-value for two BYTEA columns which is temp2 and temp3 shown as below.
I don't think I can compare it because there is no record in temp table which I use for debug purpose.

Does anyone know how to compare the after-fetched-value for two BYTEA datatype in pgsql's function?

CREATE OR REPLACE FUNCTION pa_revision(INT 4, INT4)
RETURNS INTEGER AS '
DECLARE
i_ages ALIAS FOR $1;
i_devs ALIAS FOR $2;

cur1 CURSOR FOR
SELECT a.device_id, a.baseline_revi sion_id, b.revision_id, b.operational_d evice_id <<--------- All BYTEA datatype
FROM cm_device a, cm_revision b
WHERE a.device_id = b.operational_d evice_id
AND current_date - b.creation_date > i_ages;

temp1 cm_device.devic e_id%TYPE;
temp2 cm_device.basel ine_revision_id %TYPE;
temp3 cm_revision.rev ision_id%TYPE;
temp4 cm_revision.ope rational_device _id%TYPE;
temp5 INT4;
BEGIN
OPEN cur1;
LOOP
FETCH cur1 INTO temp1, temp2, temp3, temp4;
IF NOT FOUND
THEN
RETURN 1;
END IF;

IF temp2 <> temp3 THEN <<-------------------------------- How can I compare the value of BYTEA datatype ?
SELECT count(*)
INTO temp5
FROM cm_revision
WHERE operational_dev ice_id = temp4;

insert into temp values (temp5);
.........
END IF;
END IF;

END LOOP;
CLOSE cur1;
RETURN 0;
END;
' LANGUAGE 'plpgsql';

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #1
0 1491

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2859
by: mPath Records | last post by:
Hello, I hope someone can help me with this problem - I'm getting nowhere fast and have been working on it for a week. All I'm trying to do is upload an image, store the image in a bytea column of a postrgresql database, pull the image out of the datbase, and verify that the image is still the same and it can be viewed by a browser -...
1
6575
by: Baldur Norddahl | last post by:
Hi, I need to do something like this: select * from sms where message ilike 'foo%'; Message is a bytea field with UTF-8 content. The charset is actually not important for me, it would be enough if it could just treat it as us ascii. The statement does not work because postgresql can not convert bytea to text. But this works:
2
21850
by: Alvar Freude | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I want to change a column from text to bytea; since it seems that alter table can't change the column type, i have to add a temporary column and copy the data from the old one to the new, delete the old and rename the new.
0
2361
by: Alvar Freude | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, the following I posted already on pgsql-bugs -- perhaps someone has a good workaround or fix or can say me that I'm wrong? There seems to be a bug in handling bytea columns with index and the like-operator.
4
3639
by: David Garamond | last post by:
May I request that connectby() supports BYTEA keys too? My keys are GUID (16-byte stored in BYTEA). In this case, branch_delim does not make sense because the keys should be fixed-length anyway, unless if connectby() also wants to support outputing the branch as encoded text. Btw, is recursive join (CONNECT BY ...) in SQL standard? (I have a...
7
2761
by: C G | last post by:
Dear All, What's the best way to store jpgs in postgresql to use in a web page? I tried to use large objects, but how would you extract them from a table to be viewed in a web-page without having to write them to a scratch file somewhere first? Thanks
7
4438
by: Dennis Gearon | last post by:
when bytea, text, and varchar(no limit entered) columns are used, do they ALWAYS use an extra table/file? Or do they only do it after a certain size of input? Also, if I wanted to put a *.pdf file in a bytea column, what functions do I use to escape any characters in it? ---------------------------(end of...
1
3348
by: Jerry LeVan | last post by:
Has anyone found some C code that shows how to load/extract data from a bytea column? thanks Jerry ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings
4
11412
by: Jerry LeVan | last post by:
Hi, I am adding image and large object support in my Cocoa postgresql browser. Are there going to be any enhanced bytea support functions coming along? It seems sorta silly to have to write customized C code to import a file into a bytea field.
0
7455
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7723
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7962
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6050
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5373
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3504
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3486
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1949
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
769
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.