Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. IF Condition in cursor definition

IF Condition in cursor definition

Scheduled Pinned Locked Moved Database
databasehelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    csetopper_bhanu
    wrote on last edited by
    #1

    HI all, I am new to cursor and i have a doubt... I have one vb code in which few sql statements are written. I need to convert these sql codes into pl/sql sotred procedures. But, in vb, the sql query is dynamic on the basis of values passed like..

    If Trim(txtEqpId) <> "" Then
    Sql = Sql & vbCrLf & " AND c.eqpid LIKE '" & Trim(txtEqpId) & "%'"
    End If

    This sql query is first generated and then it is being called from vb code. Now the problem is while creating pl/sql procedures, I need to make a cursor where the cursor definition has to be created dynamically {not in BEGIN block and it is not fixed}... So, can we add if condition in cursor definition statement or any other way to achieve it...

    csetopper_bhanu

    M 1 Reply Last reply
    0
    • C csetopper_bhanu

      HI all, I am new to cursor and i have a doubt... I have one vb code in which few sql statements are written. I need to convert these sql codes into pl/sql sotred procedures. But, in vb, the sql query is dynamic on the basis of values passed like..

      If Trim(txtEqpId) <> "" Then
      Sql = Sql & vbCrLf & " AND c.eqpid LIKE '" & Trim(txtEqpId) & "%'"
      End If

      This sql query is first generated and then it is being called from vb code. Now the problem is while creating pl/sql procedures, I need to make a cursor where the cursor definition has to be created dynamically {not in BEGIN block and it is not fixed}... So, can we add if condition in cursor definition statement or any other way to achieve it...

      csetopper_bhanu

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      You are looking for a dynamic where clause, take a look at come of these responses[^] Most of these will work with a cursor.

      Never underestimate the power of human stupidity RAH

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups