Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8933123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:27:50+00:00 2026-06-15T09:27:50+00:00

I am getting error while executing below query in VB (I am using macro

  • 0

I am getting error while executing below query in VB (I am using macro to run this query). But in ORACLE, the same query runs file and gives me the expected result.
Please note that, “XML_FIELD” is a CLOB Which has XML Data in it. I am trying to extract data from “XML_FIELD” using VB Macro.

Query in SQL: executes fine :
—> select xmltype(XML_FIELD).extract(‘//XML_TAGNAME/text()’).getStringVal() as NEW_COL from TAB_1 where TEST_ID = 123

Error in VB: SQL Execution Error ora-00936 missing expression

Query in VBA:
Sub Extract_CLOB()
Dim SQL As String
Dim OraDynaSet As Object
‘Comment: I am using two single quotes (‘ ‘ ) to escape the other single quote
SQL = “select xmltype(XML_FIELD).extract(”//XML_TAGNAME/text()”).getStringVal() as NEW_COL from TAB_1 where TEST_ID = 123″
Set OraDynaSet = objDataBase.DBCreateDynaset(SQL, 0&)
End Sub

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:27:52+00:00Added an answer on June 15, 2026 at 9:27 am

    I tried this code and it worked well. I added one clob field to emp table.

    Public objSession As Object
    Public objDataBase As Object
    
    Sub ConnectToOracle()
        'Create a reference to the OO4O dll
        Set objSession = CreateObject("OracleInProcServer.XOraSession")
        'Create a reference to my database
        Set objDataBase = objSession.OpenDatabase("mydb", "scott/tiger", 0&)
        Dim strSQL As String
    Dim strTxt As String
    Dim OraDynaSet As Object
    
    strSQL = "select xmltype(MyXMLField).extract('//ROWSET//ROW//JOB/text()').getStringVal() as NEW_COL from emp where empno = 2"
    
    'Retrieve the results from Oracle
    Set OraDynaSet = objDataBase.DBCreateDynaset(strSQL, 0&)
    
    strTxt = CStr(OraDynaSet.Fields(0).Value)
    
    MsgBox strTxt
    End Sub
    

    and my xml is:

    <?xml version="1.0"?>
          <ROWSET>
             <ROW num="1">
                <EMPNO>7</EMPNO>
                <ENAME>S</ENAME>
                <JOB>CLERK</JOB>
                <MGR>7</MGR>
                <HIREDATE>12/17/2008 0:0:0</HIREDATE>
               <SAL>999</SAL>
               <DEPTNO>20</DEPTNO>
            </ROW>
         </ROWSET>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While using inner join on Pro*C I am getting the below error: PCC-S-02201, Encountered
I am getting this Error while executing my android application : Host is unresolved:
While executing the code below I am getting HTTP 500 Internal Server Error. public
I'm getting an error while executing following select query: ResultSet rs = St.executeQuery(select *
I am getting following error while executing compiled jar file. I have re installed
I am getting following error while executing my java code. What is this error
While executing the code below i am getting javascript error expected object though i
I am getting this error while executing my android app. I have created the
I'm getting error while using replace in an update statement in sql server 2008.
I´m getting this error while trying to commit to a svn repository: svn: MKACTIVITY

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.