- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: Move result of select count(*) to a variable o...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2013 12:03 PM
09-24-2013 12:03 PM
Move result of select count(*) to a variable of DCl
Hi. Everyone.
i have this Dcl
$ set ver
$ Ws := "Write Sys$output"
$ Com_Totreg == 5
$ sql
DECLARE :Sql_Totreg INTEGER;
atta 'f bdcesantia';
set tran read o;
select Count(*) into :Sql_Totreg from ctabcuo;
PRINT :Sql_Totreg ;
EXIT;
$
$ Ws "Registros Leidos(Com):''Com_Totreg'"
$ Ws "Registros Leidos(Sql):''Sql_Totreg'"
$ EXIT
....the question is : how can "rescue" the result of select count(*) to a variable of Dcl.......i need somethin like this :
"Com_Totreg==Sql_Totreg"
Thanks very much.
- Tags:
- SQL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2013 12:40 PM
09-24-2013 12:40 PM
Re: Move result of select count(*) to a variable of DCl
I don't think there is a provisioned method.
Typically you would redirect the SQL output into a file or pipe, and parse the output.
You may want to check out the RDB facilty to call external function such as LIB$SET_SYMBOL or LIB$SET_LOGICAL
See : http://www.oracle.com/technetwork/products/rdb/external-routines-090694.html
hth,
Hein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2013 01:00 AM
09-25-2013 01:00 AM
Re: Move result of select count(*) to a variable of DCl
The best you can do is to define a job logical name (assumed you have SQL$DATABASE pointing to your database), like:
$ pipe ( write sys$output "set display no row counter" ; write sys$output "select '$ def/job Sql_Totreg ',Count(*) from ctabcuo;" ) | mc sql$ | @sys$pipe
$ Sql_Totreg = f$log("Sql_Totreg")
Sure enough, you can use a DCL script instead of the two write statements in parentheses.