Home » Developer & Programmer » Precompilers, OCI & OCCI » how to write PRO*C program for SQL queries (9.0.4.0)
how to write PRO*C program for SQL queries [message #321544] Tue, 20 May 2008 12:48 Go to next message
user71408
Messages: 585
Registered: November 2007
Location: NE
Senior Member
Hi All,

I wrote following SQL query in shell scripting.Now I want to write PRO*C program for the same. Please give me guidelines to write the PRO*C program
select
         cp.cost_change
||','||  cp.supplier
||','||  cp.country_id
||','||  cp.item
||','||  cp.value1
||','||  cp.uom1
||','||  cp.value2
||','||  cp.unit_cost
||','||  cp.ord_ind
||','||  cp.default_ind
||','||  cp.dept
||','||  cp.sup_dept_no
from     cost_sup cp
where    cp.cost_change     in (select ch.cost_change
                                  from   item_country     isc,
                                         cost_sup_detail  cpd,
                                         cost_sup_head    ch
                                  where  ch.active_date       =
 to_date('sysdate 00:00:00','DD-MON-YYYY HH24:MI:SS')
            and    ch.cost_change        = cpd.cost_change
            and    cpd.item              = isc.item
            and    cpd.supplier          = isc.supplier
            and    cpd.origin_country_id = isc.origin_country_id
            and    cpd.unit_cost         = isc.unit_cost)


like this I wrote 6 sql queries in the same script.

Thank you.

[Updated on: Tue, 20 May 2008 12:51]

Report message to a moderator

Re: how to write PRO*C program for SQL queries [message #321553 is a reply to message #321544] Tue, 20 May 2008 13:14 Go to previous messageGo to next message
Michel Cadot
Messages: 68728
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
So do it, what is the problem?

By the way, "to_date('sysdate 00:00:00','DD-MON-YYYY HH24:MI:SS')" is one the most awful thing I ever saw in SQL.

Regards
Michel
Re: how to write PRO*C program for SQL queries [message #321554 is a reply to message #321553] Tue, 20 May 2008 13:20 Go to previous messageGo to next message
user71408
Messages: 585
Registered: November 2007
Location: NE
Senior Member
Michel ,
I have changed the date ,i.e to_char('12-sep-2007 00:00:00').
I don't know how to write the Pro*c program.. So I need your help..
please write a Pro*c program for this then I will follow the same process for remaining queries...

Thank you.
Re: how to write PRO*C program for SQL queries [message #321561 is a reply to message #321554] Tue, 20 May 2008 13:45 Go to previous messageGo to next message
Michel Cadot
Messages: 68728
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Pro*C/C++ Getting Started for Microsoft Windows
Pro*C/C++ Programmer's Guide

Regards
Michel

Re: how to write PRO*C program for SQL queries [message #321636 is a reply to message #321561] Tue, 20 May 2008 22:35 Go to previous message
user71408
Messages: 585
Registered: November 2007
Location: NE
Senior Member
Michel,

Thank you very much and one more is the module should be designed using restart and threading logic. Just give me guide lines for this please..
Previous Topic: Syntax error in /usr/include/sys/ header files during Pro*C Compilation
Next Topic: shell script for sql queries
Goto Forum:
  


Current Time: Sun Dec 22 00:55:35 CST 2024