SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 2 of 2
  1. #1
    Senior Member
    Join Date
    Jun 2006
    Location
    India
    Posts
    117
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Need to pass value to a variable in SQL Query

    Hi,

    I am writing a script and I have all the SQL queries placed in one file and each query is identified by a unique variable. I have function to execute the SQL query, which executes and returns the recordset. I have some queries where some parameter needs to be passed into the sql query, so that the query returns the expected values.

    Qry1="select empname from employee where job="&title&" and rownum>2"

    The function is present in vbs file as given below:-
    public function excquery(query)
    Resultset=CreateObject("ADODB.Recordset")
    Set Resultset=dbconn.execute(query)
    set excquery=Resultset
    end function

    In the script

    title="manager"
    resset---is defined as recordset
    resset=excquery(Qry1)

    The script is failing while executing the script with the error missing expression.(ora00936).
    Can you help me in this regard?
    Kooltestingkings

  2. #2
    Moderator
    Join Date
    Jan 2007
    Location
    Pittsburgh, PA
    Posts
    2,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Need to pass value to a variable in SQL Query

    Try this:
    Qry1="select empname from employee where job='"&title&"' and rownum>2"

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.00%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:35 AM.

Copyright BetaSoft Inc.