11.25.2008 | |

Fuego.Sql.DynamicSQL - executeQuery - Dynamic SQL

I ran across a stituation where I had serveral different queries that I needed to write depending on if my data was populated. It could be a number of combinations, so I didn't want to use the typcial INSERT SQL statement. I needed it to be more dynamic.

Here is what I can up with:

Before starting here are some key points to remember:
ALBPM Strips off any special characters, so you need to know if you table or columns have the special characters in them before starting. For example in BPM when I look at my tables I see ACF2PROF - however my actual table name is ACF2_PROF
Also note - everything on the left hand side is an attribute I created in BPM - everything on right hand side is what I am getting from the database.


myDynamic as Fuego.Sql.DynamicSQL
myDynamic = DynamicSQL()
params as String[]
sqlCommand as String
index as Integer
index = 0
params
params[0] = String(aCF2Management.aCF2Profile.dbKey)
sqlCommand = "select * from ACF2_PROF where acf2_Prof_Id LIKE ?"

for each row in executeQuery(myDynamic, sentence : sqlCommand, implname : "External Resource Name for Database", inParameters : params) do

aCF2Management.aCF2ProfileResults[index].profiles.profDescipt = String(row["PROF_DESC"])
aCF2Management.aCF2ProfileResults[index].profiles.idModel = String(row["ID_MODEL"])
aCF2Management.aCF2ProfileResults[index].profiles.numberIds = Decimal(row["ID_QTY"])

index = index + 1
end

More help on this can be found on BEA / Oracle's website at http://download.oracle.com/docs/cd/E13154_01/bpm/docs65/standard_components/index.html?t=Fuego/Sql/DynamicSQL/DynamicSQL_component.html

0 comments: