Hello,
I have a Pro*C program which contains SQL sentences, such as:
....
Pro*C sentences
....
/*SQL 1*/
EXEC SQL SELECT t1.field1, t1.field2
INTO :w_field
FROM TABLE1 t1, TABLE1 t2
WHERE t1.field1 = t2.field1
AND t1.ID = :wl_id;
....
Pro*C sentences
....
/*SQL 1*/
EXEC... (11 Replies)
Hi, this's Pom. I'm quite a new one for shell script but I have to do sql on shell script to query some information from database.
I found a concern to get a new line...When I run my script, it retrieves all data as wondering but it's shown in one line :(
What should I do? I'm not sure that... (2 Replies)
Hi,
Can any one help me how to write a sql procedure in a pro *c file for selecting the data from a database and inserting the rows into a queue in a .pc file.
thanx in advance. (1 Reply)
hi,
I have pro*c program running on sunsolaris 5.9.Currently the same program has been migrated to solaris 5.10.But the program is not giving the desired output.Do i need to recomplie the source code again.
Regards,
Megh (4 Replies)
Hi ,
I used the below script to get the sql data into csv file using unix scripting.
I m getting the output into an output file but the output file is not displayed in a separe columns .
#!/bin/ksh
export FILE_PATH=/maav/home/xyz/abc/
rm $FILE_PATH/sample.csv
sqlplus -s... (2 Replies)
Hello,
I am trying to compile a Pro*C program under unix:
proc iname=test.pc
works fine
but then I am not able to compile the test.c file :
gcc test.c -o test.o -L $ORACLE_HOME/lib -l clntsh
/usr/bin/ld:
Object file format error in: /u01/app/oracle/product/10.1.0.2.0/lib:... (1 Reply)
In a pro*C program, I use query follow:
INSERT INTO radacct_wk
SELECT (select psid from cscterminfo where cscterminfo.TELNO = username), nasipaddress, acctstarttime, acctstoptime,
acctsessiontime, acctinputoctets, acctoutputoctets, acctterminatecause, framedipaddress
FROM radacct@DBSV_B;... (7 Replies)
Hi All,
I have written 4 SQL queries. I want to write PRO*C program for this. I want to put these 4 queries in a single PR*C program using threading concept. Please guide me to write the pogram.
the queries are as follows.
1. select * from head;
2. select * from details;
3. delete from head... (0 Replies)
I am unable to compile the programs, I am able to compile .pc to .c but later part of the compilation from .c to executalbe i am unable to do.
Here is the way i am doing
make -f $LIB_LIB/makefile.templ sample
I am getting the following errors, which environment and where to set to point... (1 Reply)
DBLINK(3) PostgreSQL 9.2.7 Documentation DBLINK(3)NAME
dblink - executes a query in a remote database
SYNOPSIS
dblink(text connname, text sql [, bool fail_on_error]) returns setof record
dblink(text connstr, text sql [, bool fail_on_error]) returns setof record
dblink(text sql [, bool fail_on_error]) returns setof record
DESCRIPTION
dblink executes a query (usually a SELECT, but it can be any SQL statement that returns rows) in a remote database.
When two text arguments are given, the first one is first looked up as a persistent connection's name; if found, the command is executed on
that connection. If not found, the first argument is treated as a connection info string as for dblink_connect, and the indicated
connection is made just for the duration of this command.
ARGUMENTS
conname
Name of the connection to use; omit this parameter to use the unnamed connection.
connstr
A connection info string, as previously described for dblink_connect.
sql
The SQL query that you wish to execute in the remote database, for example select * from foo.
fail_on_error
If true (the default when omitted) then an error thrown on the remote side of the connection causes an error to also be thrown locally.
If false, the remote error is locally reported as a NOTICE, and the function returns no rows.
RETURN VALUE
The function returns the row(s) produced by the query. Since dblink can be used with any query, it is declared to return record, rather
than specifying any particular set of columns. This means that you must specify the expected set of columns in the calling query --
otherwise PostgreSQL would not know what to expect. Here is an example:
SELECT *
FROM dblink('dbname=mydb', 'select proname, prosrc from pg_proc')
AS t1(proname name, prosrc text)
WHERE proname LIKE 'bytea%';
The "alias" part of the FROM clause must specify the column names and types that the function will return. (Specifying column names in an
alias is actually standard SQL syntax, but specifying column types is a PostgreSQL extension.) This allows the system to understand what *
should expand to, and what proname in the WHERE clause refers to, in advance of trying to execute the function. At run time, an error will
be thrown if the actual query result from the remote database does not have the same number of columns shown in the FROM clause. The column
names need not match, however, and dblink does not insist on exact type matches either. It will succeed so long as the returned data
strings are valid input for the column type declared in the FROM clause.
NOTES
A convenient way to use dblink with predetermined queries is to create a view. This allows the column type information to be buried in the
view, instead of having to spell it out in every query. For example,
CREATE VIEW myremote_pg_proc AS
SELECT *
FROM dblink('dbname=postgres', 'select proname, prosrc from pg_proc')
AS t1(proname name, prosrc text);
SELECT * FROM myremote_pg_proc WHERE proname LIKE 'bytea%';
EXAMPLES
SELECT * FROM dblink('dbname=postgres', 'select proname, prosrc from pg_proc')
AS t1(proname name, prosrc text) WHERE proname LIKE 'bytea%';
proname | prosrc
------------+------------
byteacat | byteacat
byteaeq | byteaeq
bytealt | bytealt
byteale | byteale
byteagt | byteagt
byteage | byteage
byteane | byteane
byteacmp | byteacmp
bytealike | bytealike
byteanlike | byteanlike
byteain | byteain
byteaout | byteaout
(12 rows)
SELECT dblink_connect('dbname=postgres');
dblink_connect
----------------
OK
(1 row)
SELECT * FROM dblink('select proname, prosrc from pg_proc')
AS t1(proname name, prosrc text) WHERE proname LIKE 'bytea%';
proname | prosrc
------------+------------
byteacat | byteacat
byteaeq | byteaeq
bytealt | bytealt
byteale | byteale
byteagt | byteagt
byteage | byteage
byteane | byteane
byteacmp | byteacmp
bytealike | bytealike
byteanlike | byteanlike
byteain | byteain
byteaout | byteaout
(12 rows)
SELECT dblink_connect('myconn', 'dbname=regression');
dblink_connect
----------------
OK
(1 row)
SELECT * FROM dblink('myconn', 'select proname, prosrc from pg_proc')
AS t1(proname name, prosrc text) WHERE proname LIKE 'bytea%';
proname | prosrc
------------+------------
bytearecv | bytearecv
byteasend | byteasend
byteale | byteale
byteagt | byteagt
byteage | byteage
byteane | byteane
byteacmp | byteacmp
bytealike | bytealike
byteanlike | byteanlike
byteacat | byteacat
byteaeq | byteaeq
bytealt | bytealt
byteain | byteain
byteaout | byteaout
(14 rows)
PostgreSQL 9.2.7 2014-02-17 DBLINK(3)