Help with SQL syntax
I am not very good with sqls and I am trying to understand an sql statement which I haven't seen before. We're using Oracle and the IBatis framework so this might be specific to one of those. I am not really sure.
SELECT
....
,....
,....
, PKG_LABEL.GET_LABEL_NAME('UOM',T100.CASE_DIM_UOM_CODE) AS caseDimensionsUOM
, PKG_LABEL.GET_LABEL_NAME('UOM',T100.ITEM_DIM_UOM_CODE) AS itemDimensionsUOM
, PKG_LABEL.GET_LABEL_NAME('UOM',T100.CASE_WEIGHT_UOM_CODE) AS caseWeightUOM
, PKG_LABEL.GET_LABEL_NAME('UOM',T100.PALLET_WEIGHT_UOM_CODE) AS unitNetWeightUOM
FROM
[..snipped..]
At first glance I thought the PKG_LABEL was merely a table alias but it seems that it is calling a function. I haven't h开发者_开发技巧ad much experience with stored procedures so I am wondering if it is one.
I would have looked this up in Google but I don't know what it exactly is so I don't know what search term to use.
A brief explanation and some links will be okay.
I don't know much about iBatis, but PKG_LABEL here could be a 'package' in the database. To see if a package with that name exists, you can run this query
SELECT * FROM user_objects
WHERE object_type = 'PACKAGE' AND object_name = 'PKG_LABEL';
You can get to know about packages here
PKG_LABEL probably refers to a package.
Thats the oracle name for a group of (related) functions/procedures.
Look in your schema a try to find a package names PKG_LABEL.
In its body, you should find a function named GET_LABEL_NAME , take a look at its code to know what it does...
PKG_LABEL is a PL/SQL package, which is a collection of PL/SQL functions and procedures. GET_LABEL_NAME is a function within that package, which will perform some logic on its arguments and return a value (probably a character string in this case).
精彩评论