Advertisement

09.26.2006 at 05:07PM PDT, ID: 22003930
[x]
Attachment Details

Same sql statement - Oracle Client returns records, ado command returns empty recordset

Asked by danross44 in FoxPro Database

Tags: oracle, sql, rpad, records, recordset

Have any ideas on why the following code could be returning an empty recordset (I comfirmed that the database is in fact being connected to successfully) while the same command from oracle client does in fact return records? My code is below. Please help. - Dan

* petrs_extract.prg

parameters cplan, coutputfile

objconnection = createobject("ADODB.Connection")

with objconnection
      
      wait window "Connecting to the PETRS oracle database..." nowait noclear
      
      .connectionstring = "Provider=OraOLEDB.Oracle" + ";" + "PLSQLRSet=1" + ";" + ;
            "Data Source=" + "prvdev" + ";" + "User Id=" + "petrs" + ";" + ;
            "Password=" + "petrs" + ";" + "OLE DB Services=-1" + ";" + ;
            "Persist Security Info=True" + ";"
      .cursorlocation = 3      && adUseClient
      .connectiontimeout = 120
      = .open()
      
endwith

cselecmd = "SELECT rpad(a.Provider_key,12,' '),"+;
      "rpad(a.Provider_ID,6,' '),"+;
      "rpad(a.health_plan_id,6,' '),"+;
      "rpad(a.NATIONAL_PROVIDER_ID,10,' '),"+;
      "rpad(a.REFERENCE_NUMBER,20,' '),"+;
      "rpad(a.PPCS_ID,6,' '),"+;
      "rpad(a.PPCS_KEY,8,' '),"+;
      "rpad(a.PROVIDER_NAME,40,' '),"+;
      "rpad(a.LAST_NAME,30,' '),"+;
      "rpad(a.FIRST_NAME,20,' '),"+;
      "rpad(a.MID_INITIAL,2,' '),"+;
      "rpad(a.SSN,9,' '),"+;
      "rpad(to_char(a.DATE_OF_BIRTH,'MM/DD/YYYY'),12,' '),"+;
      "rpad(a.GENDER,1,' '),"+;
      "rpad(a.PCP,1,' '),"+;
      "rpad(a.SPECIALIST,1,' '),"+;
      "rpad(a.DEGREE,6,' '),"+;
      "rpad(a.ALLIED,1,' '),"+;
      "rpad(a.LICENSE_NUMBER,20,' '),"+;
      "rpad(to_char(a.LICENSE_EXP_DATE,'MM/DD/YYYY'),12,' '),"+;
      "rpad(a.LICENSE_STATE,2,' '),"+;
      "rpad(a.DEA,10,' '),"+;
      "rpad(a.UPIN,10,' '),"+;
      "rpad(a.PRIMARY_SPECIALTY,10,' '),"+;
      "rpad(a.BOARD_CERTIFIC_FLAG,9,' '),"+;
      "rpad(to_char(a.BOARD_CERTIFIC_EXP_DATE,'MM/DD/YYYY'),12,' '),"+;
      "rpad(a.CAQH_ID,16,' '),"+;
      "rpad(to_char(a.CAQH_ROSTER_ADD_DATE,'MM/DD/YYYY'),12,' '),"+;
      "rpad(a.CAQH_ROSTER_STATUS,1,' '), "+;
      "rpad(a.AUTORIZATION_STATUS,1,' '),"+;
      "rpad(a.NON_RESPONDER_FLAG,1,' '),"+;
      "rpad(a.TAX_ID_NUMBER,20,' '),"+;
      "rpad(a.VENDOR_NUMBER,20,' '),"+;
      "rpad(a.PRACTICE_TYPE,6,' '),"+;
      "rpad(a.ADDRESS_SITE_ID,16,' '),"+;
      "rpad(a.SITE_BUSINESS_NAME,40,' '),"+;
      "rpad(a.ADDRESS_LINE_1,30,' '),"+;
      "rpad(a.ADDRESS_LINE_2,30,' '),"+;
      "rpad(a.CITY,20,' '),"+;
      "rpad(a.COUNTY,20,' '),"+;
      "rpad(a.STATE,2,' '),"+;
      "rpad(a.ZIP,9,' '),"+;
      "rpad(a.CONTACT_NAME,40,' '),"+;
      "rpad(a.CONTACT_PHONE_NUMBER,10,' '),"+;
      "rpad(a.CONTACT_E_MAIL,100,' '),"+;
      "rpad(a.CONTACT_FAX_NUMBER,10,' '),"+;
      "rpad(a.SOURCE,12,' '),"+;
      "rpad(to_char(a.ENTRY_DATE,'MM/DD/YYYY'),12,' '),"+;
      "rpad(a.ENTRY_BY ,20,' '),"+;
      "rpad(to_char(a.LAST_UPDATED_DATE,'MM/DD/YYYY'),12,' '),"+;
      "rpad(a.LAST_UPDATED_BY,20,' '),"+;
      "rpad(a.RECORD_STATUS ,1,' '),"+;
      "rpad(to_char(a.RECORD_STATUS_DATE ,'MM/DD/YYYY'),12,' '),"+;
      "rpad(a.SITE_EVAL_RESULTS ,1,' '),"+;
      "rpad(a.IPA_CODE  ,6,' '),"+;
      "rpad(a.CONTRACT_TYPE  ,2,' '),"+;
      "rpad(to_char(b.App_Received_by_HN_date ,'MM/DD/YYYY'),12,' '),"+;
      "rpad(b.App_Received_by_HN_associate, 24,' '),"+;
      "rpad(to_char(b.App_Postmarked_Date ,'MM/DD/YYYY'),12,' '),"+;
      "rpad(to_char(b.Recd_by_PNM_date ,'MM/DD/YYYY'),12,' '),"+;
      "rpad(b.Recd_by_PNM_associate, 24,' '),"+;
      "rpad(to_char(b.App_sent_to_PDM_date,'MM/DD/YYYY'),12,' '),"+;
      "rpad(b.App_sent_to_PDM_Associate, 24,' '),"+;
      "rpad(to_char(b.App_recd_by_PDM_date,'MM/DD/YYYY'),12,' '),"+;
      "rpad(b.App_recd_by_PDM_associate, 24,' '),"+;
      "rpad(to_char(b.Sent_To_Credential_date ,'MM/DD/YYYY'),12,' '),"+;
      "rpad(b.Sent_to_credential_Associate, 24,' '),"+;
      "rpad(to_char(b.CAQH_App_Print_Date ,'MM/DD/YYYY'),12,' '),"+;
      "rpad(b.CAQH_App_Print_associate, 24,' '),"+;
      "rpad(a.CAQH_ACTION_FLAG, 1, ' '),"+;
      "rpad(replace(replace(a.COMMENTS,chr(10),'<LF>'),chr(13),'<CR>'),4000,' ') "+;
      "FROM petrs_provider a, petrs_app_tracking b "+;
      "WHERE a.provider_key = b.provider_key AND record_status in ('O','X') and a.health_plan_id = '" + cplan + "'"

wait window "Selecting necessary records from petrs_provider table..." nowait noclear
      
objcommand = createobject("ADODB.Command")
      
with objcommand
      .activeconnection = objconnection
      .commandtype = 1 && adCmdText
      .commandtext = cselecmd
      rset_result = .execute()      
endwith

wait window "Converting selected petrs_provider records to csv format..." nowait

if rset_result.recordcount > 0      
                wait window "There were records selected from petrs_provider - " + alltrim(str(rset_result.recordcount)) + " of them"
else
      wait window "No Records were selected from petrs_provider for plan " + cplan + " and the coded criteria"
endif

objconnection.close()

release objconnection
release objcommand
release rset_resultStart Free Trial
 
Loading Advertisement...
 
[+][-]09.26.2006 at 05:58PM PDT, ID: 17606785

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.26.2006 at 06:21PM PDT, ID: 17606867

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.26.2006 at 06:59PM PDT, ID: 17607055

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.27.2006 at 11:51PM PDT, ID: 17616713

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: FoxPro Database
Tags: oracle, sql, rpad, records, recordset
Sign Up Now!
Solution Provided By: rabee
Participating Experts: 4
Solution Grade: A
 
 
[+][-]09.28.2006 at 11:50AM PDT, ID: 17621846

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32