Dear Esa

This is what I was looking.  There are lot of entries with
http://hdl.handle.net and i want to replace it with http://my-own-url. 
Please tell me which variables to replace with old entry
(http://hdl.handle.net) and new entry (http://my-own-url)?

Regards,

Ata

esa wrote
> 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-tp3285730p4671278.html
Sent from the DSpace - Tech mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Androi apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
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