Re: [SQL] insert record in remote database

2010-10-24 Thread Osvaldo Kussama
2010/10/24 tejas tank :
> Hello,
>     Thanks a lot,
>      This doc i have been read , i was thought it work but when i fire this
> with my plsql on that time error message come that function is not define.
>
>    how to configure the postgres database so this module will enable
>   is their any database driver have to setup or any configuration i have to
> made.
>   i am use postgresql database with ubuntu operating system. yes as you
> suggested solution will work but send me details how will i  configure...
>


Follow the instructions at:
http://www.postgresql.org/docs/current/interactive/contrib.html

For Ubuntu: with Synaptic Package Manager install postgresql-contrib.


>    My Dear, Thanks a lot for you response
>
>
>
> On Sun, Oct 24, 2010 at 3:37 AM, Osvaldo Kussama 
> wrote:
>>
>> 2010/10/22 Maruti Nandan :
>> > have any one idea !!!
>> >
>> > postgres db, to insert record in a table of other database through
>> > function!!!
>> >
>> >
>> > u see the dblink , but it just use for select statement i want to
>> >
>> >
>> > when trigger fire i want to insert record in other db
>> > --
>>
>>
>> From manual:
>>
>> dblink_exec executes a command (that is, any SQL statement that
>> doesn't return rows) in a remote database.
>>
>> http://www.postgresql.org/docs/current/interactive/contrib-dblink-exec.html
>> "sql: The SQL command that you wish to execute in the remote database,
>> for example insert into foo values(0,'a','{"a0","b0","c0"}'). "
>>


Osvaldo

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


[SQL] How to search for a part of a number

2010-10-24 Thread Andreas

Hi,

I'm wondering if there was a clever way to find parts of a numeric 
string in another table.
There is a table that holds city-codes and city-names. City-code would 
be the part of a phone number that identifies the city.

Over here this code can have 2 - 5 digits. So the table would contain:
23 ; A-City
345 ; B-Town
4455 ; C-Village
632 ; D-Town
...

I'm quite sure the numbering system is bound to be spanning a search tree.

So there are 2 tasks:
a)   I'd get 445598765 in and like to know the corresponding city
b)   I'd like to get the number nicely formatted :  4 4 55987-65  -->  
4455 / 98765


Obviously one could do it on the client side.
As I dont know how many digits in the input are relevant, I need to try 
the shortest code first.

1)  search for 44
2)  add 5 and search for 445
3)  add the 2nd. 5 and search for 4455
BINGO

Is there a way to do it within the db?

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql