Hi,

try use this, i have make a function on posgre to change the canonical URl
for the old items.

CREATE OR REPLACE FUNCTION update_dc_indentifier_uri_prefix (new_uri_prefix
TEXT, old_uri_prefix TEXT)
RETURNS INTEGER
AS $$
DECLARE
uri_database_old        CURSOR FOR SELECT metadata_value_id, text_value
                                                        FROM metadatavalue
                                                        WHERE metadata_field_id 
='25';
metadata_id                     metadatavalue.metadata_value_id%TYPE;
uri_old                         metadatavalue.text_value%TYPE;
BEGIN
                RAISE NOTICE 'Open the Cursor...';
                OPEN uri_database_old;
                LOOP
                        RAISE NOTICE 'Fetch the cursor into variable...';
                        FETCH uri_database_old INTO metadata_id, uri_old;
                        IF NOT FOUND THEN
                                EXIT;
                        END IF;
                        RAISE NOTICE 'update a new URI...';
                        UPDATE metadatavalue
                        SET text_value = REPLACE (uri_old ,$2 ,$1)
                        WHERE metadata_field_id = '25'
                        AND metadata_value_id = metadata_id;
                END LOOP;
                RAISE NOTICE 'close the cursor...';
                CLOSE uri_database_old;
                RAISE NOTICE 'The process is completed...';
                RETURN 0;
EXCEPTION
                WHEN OTHERS THEN
                        RAISE EXCEPTION 'Process in the function fail !!';
                
END     
$$ language PLPGSQL



--
View this message in context: 
http://dspace.2283337.n4.nabble.com/How-change-uri-handle-from-http-hdl-handle-net-to-http-myip-in-all-items-tp3285730p4664552.html
Sent from the DSpace - Tech mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech
List Etiquette: https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette

Reply via email to