Home > Computers and Internet > [PostgreSQL] dblink

[PostgreSQL] dblink

dblink_connect

dblink_connect (text connstr) returns text
dblink_connect (text conname, text connstr) returns text

(example 1)
SELECT dblink_connect (‘connect_name’, ‘hostaddr=10.3.4.13 port=5432 dbname=db_kr_patent user=postgres password=xxxx’);

(example 2)
CREATE TABLE t_publish AS
SELECT id_kipi, publn_nat_cd_std, dnum_kipi, dnum_jgr, doc_kind_std, doc_publn_date
FROM dblink(‘jpnips_connect’,’select id_kipi, publn_nat_cd_std, dnum_kipi, dnum_jgr, doc_kind_std, doc_publn_date from t_publish’)
AS t1 (  id_kipi character varying(32),
publn_nat_cd_std character varying(8),
dnum_kipi character varying(32),
dnum_jgr character varying(32),
doc_kind_std character varying(8),
doc_publn_date character varying(16)
);

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: