mardi 19 avril 2011

How to create method find in a table

Follow this example:

static Thy_DimensionsNivels find(ProjCategoryId _projCategoryId, boolean _forUpdate = false)
{
    Thy_DimensionsNivels   thy_DimensionsNivels = null;
    ;

    Thy_DimensionsNivels.selectForUpdate(_forUpdate);

    if (_projCategoryId)
    {
        select firstonly thy_DimensionsNivels
                index hint DimensionIdx
                    where thy_DimensionsNivels.ConcatNum  == _projCategoryId;
    }

    return thy_DimensionsNivels;
}

Or this one in the inventDim Table 

static public InventDim find(InventDimId inventDimId, boolean _forupdate = false)
{
    InventDim inventDim;
    ;

    if (inventDimId)
    {
        if (_forupdate)
            inventDim.selectForUpdate(_forupdate);

        select firstonly inventDim
            index hint DimIdIdx
            where inventDim.InventDimId  == inventDimId;
    }

    return inventDim;
}

Aucun commentaire:

Enregistrer un commentaire