How to obtain aggregate results using ODBC?
How do I obtain results of an aggreate functions like SUM etc? I have an MFC application that uses CRecordset. Following is the code snip:
CDatabase db1;
o1 db; // class that is a sub class of CRecordset and makes a connection to the Oracle
// database
try
BOOL bUseCursorLib = FALSE;
db1.Open(_T( "globaldb" ), FALSE, FALSE, _T( "ODBC;UID=scott;PWD=tiger" ),FALSE);
catch(CDBException* e)
TRACE0(e->m_strError + "\n");
AfxMessageBox("Error... "+e->m_strError);
e->Delete();
if( db1.IsOpen() )
db1.Close();
CString strCmd = "select sum(ordernumber) from orders";
try
db1.ExecuteSQL( strCmd );
catch(CDBException *e)
AfxMessageBox("Error here: "+e->m_strError);
CString t;
t.Format("Sum=%ld",db.m_sum_ORDERNUMBER);
AfxMessageBox(t);
I always get zero displayed as the sum. I am going wrong somewhere for sure. I am not able to figure out.
This ought to work. Can you verify that you have the latest ODBC driver and that you have the proper version of the MDAC installed?
Justin
Similar Messages
-
How connect the oracle/Linux using ODBC
I want to connect the Oracle which install on Linux using Odbc, so my win98 machine can connect with the oracle.
But I don't know how to do ? May I install some Odbc driver in the Linux machine? and install odbc driver in my win98 machine?
my email: [email protected]You may use this way:
1. Start on the server (Linux) Net*8 listener (lsnrctl start)
2. Install on the client (win98) Net*8 and configure it (Net8 Easy Configuration)
3. Install on the client (win98) ODBC drivers for ORACLE (by ORACLE or others) and configure it -
How to get sequence result using httpservice
I send 2 httpservice requests to server: requestA and
requestB in sequence, but sometime I get the response of responseB
first. How can I get the sequence result, response from A and then
response from B.use AsyncToken - assign it to your HTTPService like so....
var tok:AsyncToken = myservice.send(params)
tok.requestName = "myRequest"
Then in your resultHandler test for the token
if(event.token['requestName']=='myRequest'){
do something with the event.result
} -
How to find payroll results using includes
hi all,
I have a requirement to get the payroll results of number of data clusters using includes not by using function modules.
I know by using function modules.
How to find out the exact include for given data cluster. If there is any path please let me know.
thanks & regards,
sekhar.Hi,
You can define macros in the program and call depending on the cluster you need.
For Eg for B2 cluster,
rp-imp-c2-b2.
before calling macros,
You should fill the key
move pernr to b2-key-pernr.
move year to b2-key-pabrj.
move period to b2-key-pabrp.
move '1' to b2-key-cltyp.
rp-imp-c2-b2.
For payroll
RP-IMP-C2-RU
Regards,
Manoj. -
How to get fixed results using JPA
Hi
I have a table with lot of rows, when I querry, it is taking a lot of time and I am displaying that many rows in UI in single table. So it is not scaling well.
SO I am planing to show x number of row in on page. So for that to achieve, how do I querry the db (derby) using JPA to get first 25 rows, next 25 rows...
I appricate any help
thanksi think you can have a serial number column in your table and you keep track of that serial number. I mean pass it to your method along with the size of page. Lets say if the number starts from 0 then you can calculate the first page using starting number + page size, if your page size is 25 then you will get 0+25 =25 and you can use the result to query from database like;
select * from myTable where rowNo<=25
You can store this number (Now 25) in user's session and pass it to the method. -
How to obtain object number using cost center??
hI.
i need to obtain all the cost elemnts of a particular cost center..
cost elemnt can b fetched from COSP using OBJNR..
How do i obtain OBJNR using KOKRS,KOSTL????Hi
From the table
CSSK
take the related Cost elements for a cost center.
Concatenate the cost element with KS and other Orgn unit
and pass to the Costing tables
see an entry in those tables you will know what are the fields in OBJNR that are concatenated
Reward points if useful
Regards
Anji -
ABAP HR - How to insert payroll results using fm PYXX_WRITE_PAYROLL_RESULT
Hi,
I have a scenario where I want to read cluster information (PCL2 RX) from system A and insert it into system B. Both systems are SAP ECC 6.0. Employee master data already exists on target system, but no payroll results yet, so this is an insert and not an update.
I am using fm PYXX_READ_PAYROLL_RESULT (I also tried with HRCM_PAYROLL_RESULTS_GET) to read the data and then calling a RFC on system B where I use fm PYXX_WRITE_PAYROLL_RESULT to write the payroll results into database. Is this fm only to use in case of update, or it should also work when inserting new lines on the cluster? Because I always get a sy-subrc=0 but nothing is created on the db. Is there any other way to this? Do you have any code samples?
Many thanks,
MiguelHI Miguel:
I have succe add of new payroll records, the following reference code:
*& Report ZTEST_BJARNE8
REPORT ztest_bjarne8.
TABLES:pcl1,pcl2.
INCLUDE rpc2cd00. "Cluster CD data definition
INCLUDE rpc2ca00. "Cluster CA Data-Definition
INCLUDE pc2rxcn0. "Cluster CN data definition
INCLUDE rpc2rx00. "Cluster RX data definition internat. part
DATA: refvar_curr TYPE REF TO data.
DATA: refvar_prev TYPE REF TO data.
DATA: refvar_cumul TYPE REF TO data.
DATA: t52relid_header TYPE t52relid.
FIELD-SYMBOLS: <payresult_current>.
DATA: employee_number LIKE pc200-pernr,
client LIKE sy-mandt,
globalmolga TYPE T500L-MOLGA,
cluster_id LIKE t500l-relid,
isocode LIKE t500l-intca.
DATA: rgdir_entry LIKE pc261.
CALL FUNCTION 'HR_PCLX_INIT_BUFFER'.
employee_number = '81000463'.
CLEAR:rgdir.REFRESH rgdir[].
CALL FUNCTION 'CU_READ_RGDIR_NEW'
EXPORTING
persnr = employee_number
check_read_authority = space
imp_client = client
TABLES
in_rgdir = rgdir
EXCEPTIONS
no_record_found = 1
import_mismatch_error = 2
no_read_authority = 3
OTHERS = 4.
LOOP AT rgdir.
ENDLOOP.
cluster_id = 'CN'.
SELECT SINGLE * FROM t52relid INTO t52relid_header
WHERE relid = cluster_id.
CREATE DATA refvar_curr TYPE (t52relid_header-typename).
ASSIGN refvar_curr->* TO <payresult_current>.
CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
EXPORTING
clusterid = cluster_id
employeenumber = employee_number
sequencenumber = rgdir-seqnr
check_read_authority = space"false "already done
filter_cumulations = space
CHANGING
payroll_result = <payresult_current>
EXCEPTIONS
illegal_isocode_or_clusterid = 1
error_generating_import = 2
import_mismatch_error = 3
subpool_dir_full = 4
no_read_authority = 5
no_record_found = 6
versions_do_not_match = 7
OTHERS = 8.
IF NOT <payresult_current> IS INITIAL.
"TODO changed RT data......
"Add new month payresult
rgdir-seqnr = rgdir-seqnr + 1.
CALL FUNCTION 'PYXX_WRITE_PAYROLL_RESULT'
EXPORTING
clusterid = cluster_id
employeenumber = employee_number
sequencenumber = rgdir-seqnr
payroll_result = <payresult_current>
CLIENT =
EXCEPTIONS
illegal_isocode_or_clusterid = 1
error_generating_export = 2
export_error = 3
subpool_dir_full = 4
no_update_authority = 5
incomplete_result_imported = 6
OTHERS = 7
IF sy-subrc <> 0.
ENDIF.
APPEND rgdir.
globalmolga = '28'.
client = '200'.
CALL FUNCTION 'CU_WRITE_RGDIR_NEW'
EXPORTING
persnr = employee_number
molga = globalmolga
imp_client = client
TABLES
rgdir = rgdir
EXCEPTIONS
no_update_authority = 1
OTHERS = 2.
CALL FUNCTION 'HR_FLUSH_BUFFER_UPDATE_PCLX'
EXPORTING
test = space
EXCEPTIONS
insert_error = 1
no_update_authority = 2
OTHERS = 3.
IF sy-subrc <> 0.
"MESSAGE e062.
ENDIF.
ENDIF.
"INCLUDE rpc2cd09.
*& INCLUDE
INCLUDE rpppxd00. "Data definition buffer PCL1/PCL2
INCLUDE rpppxd10. "Common part buffer PCL1/PCL2
INCLUDE rpppxm00. "Buffer handling routine -
Problems with obtaining actual results using the FFT VI.
I'm using the FFT express VI and graphing the results. My experiment involves decreasing the amplitude of a 100Hz acoustic pressure wave, ideally to zero, by phasing it with another signal of the same frequency and amplitude. According to other analysis I believe that the amplitude from the FFT of the signal is increasing and then decreasing. However, I am not able to visually see this in real-time on the graphical display.
The change in amplitude is happening quickly, every few ms. Is this timing to fast for the process to maintain proper resolution? Is there a way to make the output from the FFT more sensitive?
Thanks for the help.The period of a 100 Hz signal is 10 ms. If your amplitude is changing every few ms, an FFT is not going to reflect this accurately. The FFT is basically defined for constant amplitude during the segment of signal being analyzed. The FFT also typically requires several cycles to give useful results. If it changes during this time, other techniques must be used to detect that. There is a large body of literature on time-frequency analysis dealing with this topic.
Lynn -
How to achieve this result using sql query?
hello gurus,
i have a table like this
id name
1 a
2 b
3 c
4 d
5 e
6 f
7 g
8 h
9 i
10 j
11 k
12 l
13 m now my result should be like this
id name id name id name
1 a 6 f 11 k
2 b 7 g 12 l
3 c 8 h 13 m
4 d 9 i
5 e 10 jhow to achieve it by sql query ?
thanks and regards,
friend
Edited by: most wanted!!!! on Feb 22, 2012 5:55 AMhi,
Did you mean this:
with a as
(select 1 id ,'a' name from dual
union all select 2 id ,'b' name from dual
union all select 3 id ,'c' name from dual
union all select 4 id ,'d' name from dual
union all select 5 id ,'e' name from dual
union all select 6 id ,'f' name from dual
union all select 7 id ,'g' name from dual
union all select 8 id ,'h' name from dual
union all select 9 id ,'i' name from dual
union all select 10 id ,'j' name from dual
union all select 11 id ,'k' name from dual
union all select 12 id ,'l' name from dual
union all select 13 id ,'m' name from dual
select
id_1
,name_1
,id_2
,name_2
,id_3
,name_3
from
select
id id_1
,name name_1
,lead(id,5) over (order by id) id_2
,lead(name,5) over (order by id) name_2
,lead(id,10) over (order by id) id_3
,lead(name,10) over (order by id) name_3
,rownum r
from
a
where
r <=5
D_1 NAME_1 ID_2 NAME_2 ID_3 NAME_3
1 a 6 f 11 k
2 b 7 g 12 l
3 c 8 h 13 m
4 d 9 i
5 e 10 j Regards,
Peter -
How to Obtain a Distribution Provisioning Profile from Apple
hi everybody!
I'm searching in the apple.com site where I can register me to obtain a distribution provisioning profile, can anybody help me?
thx!Hi Angelo, and welcome to the Dev Forum!
A provisioning profile is one of the documents you can obtain at the Developer Program Portal once you're a member of the program. Normally you would first register as an iPhone Developer at the iPhone Dev Center to access the free developer tools and the extensive iPhone Reference Library.
The home page of the iPhone Dev Center includes a link to information about the iPhone Developer Program. Once you decide on the type of membership you require (e.g.: Standard Program $99; Enterprise Program $299), you can proceed to the online application form.
Once you are accepted into the program (the waiting time may vary from less than one day to several weeks), you will obtain access to the Program Portal which provides detailed instructions on how to obtain, install and use the various documents including the provisioning profiles. Note that an iPhone developer does not normally obtain a Distribution Provisioning Profile until completing and thoroughly testing an iPhone app using one or more Device Provisioning Profiles. A Distribution Certificate and Profile is only used when building the version of your app which will be submitted for review and placed in the iTunes Store if accepted.
Hope that helps!
\- Ray -
How to obtain date of creation if image is obtained using getImage()
When Image is obtained using getImage() method , how to
obtain date of creation or another header value if image is
obtained using getImage method.Actually, some formats do indeed have creation or modification dates built in. e.g. http://www.w3.org/TR/PNG-Chunks.html#C.tIME. (Of course since most programs save a new copy of the file every time, the two dates are the same.) However, just because formats have this data doesn't mean it's reliable or even present. Your best bet is to pass creation dates in an Applet param tag for applets (assuming you were referring to Applet.getImage()) or to parse out a filename from a classloader URL and use a File object to check (assuming you were instead referring to Toolkit.getImage(URL)). That's the best answer I have without knowing more about what you are trying to accomplish.
-
How can I connect to the database using ODBC within excel.
Hi,
How can I connect to the database using ODBC within excel and just refresh the data when needed.
Thanks,
Priyanka
Edited by: user554934 on Jun 9, 2009 2:53 AMThis is NOT an APEX relevant question, try posting it in the SQL/PL/SQL Forum..
Thank you,
Tony Miller
Webster, TX -
How to use ODBC SQLDriverConnect() without using tnsnames.ora file
I have an ODBC application that connects to an Oracle 10g database. Currently, my SQLDriverConnect() function call uses the following connection string:
DRIVER={Oracle in OraClient10g_home1}; DBQ=MyDB.world; DBA=W; UID=foo; PWD=bar
This requires an entry in the tnsnames.ora file that looks like this:
MyDB.world =
(DESCRIPTION = (ADDRESS_LIST =
(ADDRESS =
(PROTOCOL = TCP)(Host = server1.intel.com)(Port = 1521)
(ADDRESS =
(PROTOCOL = TCP)(Host = server2.intel.com)(Port = 1521)
(ADDRESS =
(PROTOCOL = TCP)(Host = server3.intel.com)(Port = 1521)
(ADDRESS =
(PROTOCOL = TCP)(Host = server4.intel.com)(Port = 1521)
(LOAD_BALANCE = yes)
(CONNECT_DATA = (SERVER = DEDICATED)
(SERVICE_NAME = MY_SRVC))
However, I would really like to be able to connect using ODBC without having to create that entry in the tnsnames.ora file. I have tried to substitute the DBQ=MyDB.world with the entire (DESCRIPTION=..... string from the original tnsnames.ora file, but it returns the error:
ORA-12154: TNS: Could not resolve the connect identifier specified.
I have heard others are able to use sqlplus with no tnsnames.ora file and the do specify the entire (DESCRIPTION=.... string on the sqlplus connection string, but is this possible to do using the ODBC SQLDriverConnect() function? If so, do I need to use a different keyword/value pair other than DBQ=?
Any help on this would be greatly appreciated.
Thank you.How would that work in a load balanced configuration? Take a closer look at the tnsnames.ora example I included in my original post. I have 4 ADDRESS= sections to denote 4 servers that are part of the load balanced environment.
Also, I'm not familiar with that syntax, I need to use the syntax supported by the SQLDriverConnect() API function, which looks like this:
DRIVER={Oracle in OraClient10g_home1}; DBQ=MyDB.world; DBA=W; UID=foo; PWD=bar
I don't know as SQLDriverConnect() would accept an alternative syntax. But the more important issue here is the ability to specify those 4 servers in the load balanced configuration as indicated by that tnsnames.ora entry. -
'Cannot obtain error message from server' when trying to use ODBC
Post Author: Grant C
CA Forum: Data Connectivity and SQL
Hi, I'm developing some reports using Crystal XI on my local PC, using an Oracle 10i back end on a separate server. The SQL for the report is in a method in an oracle package.
When I set the datasource location, selecting 'Oracle Server' then entering the details works fine, and the report runs. However, when I try to use an ODBC connection I get the following error:
Database Connection Error: 'Cannot obtain error message from server.'
The ODBC link is set up as a System DSN, which works fine when I test it. I think I need to use ODBC as some of the reports (which I inherited) seem to fail when run on the Crystal Server, and it seeme to be the ones set up with ODBC which work.
Any thoughts? Thanks.Hi Mars-
It sounds like your NI-DAQ installation may have become corrupted. I would suggest uninstalling and reinstalling the DAQmx 7.4 driver to correct this problem and ensure that you're up to date. This download is available here: NI-DAQ 7.4
If the problem persists you may want to uninstall and reinstall LabVIEW and then NI-DAQ in that order. The error message will usually give an indication as to which VI the error occurred in. Please let us know which VI is failing if you're unable to avoid the error with these suggestions.
Have a good day-
Tom W
National Instruments -
How to call PL/SQL stored procedure using ODBC?
Could anyone tell me how can I call PL/SQL stored procedure using
ODBC? Are there any sample codes?
Thanx!
nullYou are correct on all counts, they all should work.
Oracle Product Development Team wrote:
: Hi,
: I don't know the exact syntax in ODBC, but reasoning by analogy
: with other API's, I'd bet one of the following works
: (for a call to: procedure my_proc(n1 number, n2 number);):
: "{ my_proc(1,2); }"
: "{ call my_proc(1,2); }"
: "{ begin my_proc(1,2); end }"
: "begin my_proc(1,2); end;"
: "begin my_proc(1,2); end"
: Hope this helps. - Pierre
: jiangbuf (guest) wrote:
: : Could anyone tell me how can I call PL/SQL stored procedure
: using
: : ODBC? Are there any sample codes?
: : Thanx!
: Oracle Technology Network
: http://technet.oracle.com
null
Maybe you are looking for
-
HT201371 Why does it keep asking me to enter my password at least once a day when buying apps?
I have touchid setup yet when I go to buy apps it asks me to "verify" by entering my password. What a load.... Why can't it just take my fingerprint?
-
Itunes no longer compatible with 'show what i'm listening to' on msn?
Hiya, I upgraded to itunes 8, and after this noticed that on windows live messenger the songs I play are no longer shown as what I'm listening to. I wondered if anyone else had experienced this? I've upraded to itunes 8.01 now and still they aren't s
-
Getting the name of the current user loged in with j_security_check
Is there any method or way of getting the username of the current user which is logged in via the j_security_check? thanks
-
Quiet down OSX when receiving/making a call on mobile phone
Hi everyone, I want to write an application in JAVA which will quiet down the system volume when I am either receiving or making a call on my Nokia E66 mobile phone. Where can I read up on what I have to do to get my mobile phone to broadcast that in
-
ITunes want Launch, QuickTime Crashes after Installing
After my laptop crashes to the BSOD, this is what the screen reads. A problem has been dected and windows has been shut down to prevent damage to your computer. If this is the first time you've seen this stop error screen restart your computer. If th