Define variable

Hello Gurus,
        I will define a variable, used in the container of alert category,  which is used in broadcasting to exception. in that way, the value of the variable correspond to the characteristic value for those exception. 
      please show me how to define this type of variable?
Many thanks,
Frank Zhang

Hi
i define a Sp like this....
ok now when i execute Sp , ask me for input value for variable,
exception first VARIABLE for another i want fill then in sp not by user 
how can i do that.
thanks
Hi, 
Is this what you are looking for?
(i just moved the variable declaration inside the "begin,end" section)
* If you want the user to insert the values while executing then the variable  should be before the "AS"
CREATE PROCEDURE GetVamDataByMemberID1
AS
BEGIN
-- Add the parameters for the stored procedure here
DECLARE @MemberID int = 0;
DECLARE @MemberShoAmountPay int =0;
DECLARE @membershipDebtPay int =0;
DECLARE @memberTotal int =0;
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
(Select @membershipDebtPay = sum(tblMembershipAmount.MembershipPay) from tblReimburseDeptPay
where tblReimburseDeptPay.memberID = @MemberID)
(SELECT @membershipDebtPay = sum(tblReimburseDeptPay.ReimburseDeptPay) from tblReimburseDeptPay
where tblReimburseDeptPay.memberID = @MemberID)
Select @memberTotal = @MemberShoAmountPay + @membershipDebtPay
if (@memberTotal >0 )
Begin
INSERT INTO [dbo].[tbl-New-CheckOut]
([MemberId]
,[MembernationalCode]
,[Creator]
,[Debtor]
,[CheckOutDate]
,[Description])
VALUES
(@MemberID,
(select NationalCode from tblMembers where ID = @MemberID),
@memberTotal,
0,
GETDATE(),
'new')
end
if (@memberTotal <0 )
Begin
INSERT INTO [dbo].[tbl-New-CheckOut]
([MemberId]
,[MembernationalCode]
,[Creator]
,[Debtor]
,[CheckOutDate]
,[Description])
VALUES
(@MemberID,
(select NationalCode from tblMembers where ID = @MemberID),
0,
@memberTotal,
GETDATE(),
'new')
end
END
GO
[Personal Site] [Blog] [Facebook]

Similar Messages

  • How to define variables in toad sql script editor - newbie

    I have just pull out the script of a Function and want to run it on toad SQL editor.
    I am little bit confused how to define the VARIABLEs here in toad SQL editor to run my script.
    SELECT
    NVL(SUM(debit), 0) - NVL(SUM(credit), 0)
    INTO l_accountBalance
    FROM
    GLP_VoucherMaster vm
    INNER JOIN GLP_VoucherDetail vd ON vm.GLP_VoucherMaster_ID = vd.GLP_VoucherMaster_ID
    INNER JOIN GLP_ChartOFAccounts coa ON vd.GLP_ChartOfAccounts_ID = coa.GLP_ChartOfAccounts_ID
    WHERE
    vm.isActive = 'Y' AND vd.isActive = 'Y'
    -- *** how to define variables in toad sql script editor ***
    AND vm.voucherDate < p_cDate
    AND coa.AccountCode LIKE p_accountCode || '%';
    Thanks
    w\

    Just prefix with a colon (:)
    SELECT   NVL (SUM (Debit), 0) - NVL (SUM (Credit), 0)
      INTO   L_accountbalance
      FROM           Glp_vouchermaster Vm
                 INNER JOIN
                     Glp_voucherdetail Vd
                 ON Vm.Glp_vouchermaster_id = Vd.Glp_vouchermaster_id
             INNER JOIN
                 Glp_chartofaccounts Coa
             ON Vd.Glp_chartofaccounts_id = Coa.Glp_chartofaccounts_id
    WHERE       Vm.Isactive = 'Y'
             AND Vd.Isactive = 'Y'
             AND Vm.Voucherdate < :P_cdate
             AND Coa.Accountcode LIKE :P_accountcode || '%';
    /:p

  • Using user defined variables in SAP BPC 7.0 NW

    Hi,
    I am using BPC 7.0 SP2 NW version. I want to do some calculatioins and/or comparision in the script logic by using user defined variables.
    For Ex: I want to assign the property TIMEID of TIME dimension to a variable and then use this variable in my IIF statement.
    I have tried a lot but not getting any solution.
    Can anyone guide me in how to use user defined variables in Script Logic.
    Your valuable reply is appreciated.
    Thanks & Regards
    Manoj Damle

    Hi,
    Thanks for the valuable reply.
    But i want to define variables in the Script Logic and not in the Data Manager.
    The scenario is like this:
    I want to check the value of the DUMMYACC1 member of GL_ACCOUNT dimension with a constant and depending on the condition i want to update a user defined variable. This variable will further be used in the *SELECTCASE statement for decision making.
    The Code is as follows:
    *XDIM_MEMBERSET COMP_CODE = COMP_CODE_1
    *XDIM_MEMBERSET BUS_AREA = BUS_AREA_1
    *XDIM_MEMBERSET VERSION = VERSION_1
    *XDIM_MEMBERSET CURRENCY = AUD
    *XDIM_MEMBERSET DATASRC = DATASOURCE_1
    *XDIM_MEMBERSET GL_ACCOUNT = SALESREVENUE,PRICE,QUANTITY,DUMMYACC1
    *XDIM_MEMBERSET TIME=2009.MAY,2009.JUN
    *XDIM_MEMBERSET CUSTOMERCATEGORY = CUSTOMER_CAT_1
    *XDIM_MEMBERSET PROFIT_CTR = PROFIT_CTR_1
    *XDIM_MEMBERSET SEGMENT = SEGMENT1
    *XDIM_MEMBERSET MEASURES = PERIODIC
    *FUNCTION PRO(%VAR1%,%VAR2%)
        [%VAR1%].CURRENTMEMBER.PROPERTIES("%VAR2%")
    *ENDFUNCTION
    *FOR %GL_ACC% = DUMMYACC1
        *FOR %CV_TIM% = 2009.MAY,2009.JUN
            #CUR_MTH = IIF(([GL_ACCOUNT].[%GL_ACC%],[TIME][%CV_TIM%]) = 1.,1,NULL)
        *NEXT
    *NEXT
    *SELECTCASE #CUR_MTH
    *CASE 1
        #CURRENTMTH = PRO(TIME,TIMEID)
    *ENDSELECT
    The errors which system gives is:
    1. Duplicate formula found
    2. Invalid MDX statement
    3. #CUR_MTH & #CURRENTMTH is not a valid member
    Please give your valuable suggestion.
    Thanks and Regards
    Manoj Damle

  • How To guide...for Flat File upload for User-Defined variables

    Has anyone got link to the guide that describes how to do a flat file upload for populating User-Defined Variables ?
    Any assistance will be appreciated.
    Uche

    SAP BW Business Planning and Simulation "How To" Guides
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/ab9fd590-0201-0010-2590-be78eb70015c
    How to Upload User-Specific Variable Selections in BW-BPS
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/how to upload user-specific variable selections in bw-bps.pdf
    this is what you are looking for ?
    Message was edited by: Murali

  • How to define variable for value range in Bex Query?

    Hi
    How to define variable for Keyfig. value range on runtime like characteristic in Bex Query?
    Example: On runtime user select one of the following condition:
    1)User want to those records where amount is greater than $1000
    2)User want to those records where amount is greater than $1000 and less than $5000
    3)User want to those records where amount is greater than and equal to $1000

    Hi ,
    Need to Use exceptions & conditions for this scenario's  & need to create variable for exceptions based on condtions.
    Below document provides steps how to make selections at run time for a kfg.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60b33a28-dca2-2d10-f3b2-d2096b460b1e?QuickLink=index&overridelayout=true&48842368468641
    Regards,
    Seshu.P

  • How can i see the code of SAP Exit for SAP Defined Variables

    Hi,
       It's very Urgent! How can i see the Source Code of SAP Provided Variables. I need to write code for User Defined Variables. please help me. It's very Urgent.
    Thanks in Advance.
    Nagesh.

    hi Nagesh,
    sample code for variable exit,
    there is 'how to' docs, can't see your email address.
      DATA: L_S_RANGE TYPE RSR_S_RANGESID.
      DATA: LOC_VAR_RANGE LIKE RRRANGEEXIT.
      CASE I_VNAM.
      WHEN 'CUMMONTH'.
        IF I_STEP = 2.                                  "after the popup
          LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
                  WHERE VNAM = 'MONTH'.
            CLEAR L_S_RANGE.
            L_S_RANGE-LOW      = LOC_VAR_RANGE-LOW(4)."low value, e.g.200001
            L_S_RANGE-LOW+4(2) = '01'.
            L_S_RANGE-HIGH     = LOC_VAR_RANGE-LOW.   "high value = input
            L_S_RANGE-SIGN     = 'I'.
            L_S_RANGE-OPT      = 'BT'.
            APPEND L_S_RANGE TO E_T_RANGE.
            EXIT.
          ENDLOOP.
        ENDIF.
      ENDCASE.

  • Want to read a Query list of results into a defined variable "as Collection" for later use (ie create reports)

    The following code works great (Functions Main and OpenThisFile ) to select files from a folder and read into defined variable "FileToProcess As Collection" (I guess then renamed fil) and use that list of files to run through
    an import process defined in a function "StartMe". 
    What I want to do is read the results of a query into a similar collection variable and then use in a function like "StartMe" to run a series of reports.  The functions to do that below (PrintCKListTables and ReadQueryOfSDGs) currently
    don't work erring out "For Each s In .selectedQuery".  I would appreciate any help guiding me how to fix function
          ReadQueryOfSDGs() As Collection
    Thank you very much in advance for your help!
    Public Function Main()
    Dim FilesToProcess As Collection, fil
    Dim initialFilePath As String
    initialFilePath = CreateObject("WScript.Shell").specialfolders("C:\temp")
    Set FilesToProcess = OpenThisFile(initialFilePath)
    For Each fil In FilesToProcess
    StartMe fil
    Next fil
    End Function
    Public Function OpenThisFile(initialFilePath As String) As Collection
    'Requires reference to Microsoft Office 12.0 Object Library.
    Dim fDialog As Office.FileDialog
    Dim varFile As Variant
    'Clear listbox contents.
    'Me.FileList.RowSource = ""
    'Set up the File Dialog.
    Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
    With fDialog
    'Allow user to make multiple selections in dialog box.
    .AllowMultiSelect = True
    .InitialFileName = initialFilePath
    'Set the title of the dialog box.
    .Title = "Please select one or more files"
    'Clear out the current filters, and add our own.
    .Filters.Clear
    .Filters.Add "XML Files", "*.XML"
    'Show the dialog box. If the .Show method returns True, the
    'user picked at least one file. If the .Show method returns
    'False, the user clicked Cancel.
    If .Show = True Then
    'Loop through each file selected and add it to the list box.
    Dim s
    Set OpenThisFile = New Collection
    For Each s In .SelectedItems
    OpenThisFile.Add s
    Next s
    Else
    MsgBox "You clicked Cancel in the file dialog box."
    NotContinue = True
    End If
    End With
    End Function
    Public Function PrintCkListTables()
        Dim FilesToProcess As Collection, fil
        Dim ListSDGs As String
        Set FilesToProcess = ReadQueryOfSDGs(ListSDGs)
        For Each fil In FilesToProcess
            fNameExportpdfReport (fil)
        Next fil
    End FunctionPublic Function ReadQueryOfSDGs() As Collection       DoCmd.OpenQuery "y_qs_DataIn_All_SDGList"
           Dim s
           Set ReadQueryOfSDGs = New Collection
           For Each s In .selectedQuery
           ReadQueryOfSDGs.Add s
           Next s
    End Function

    There are a few problems here. In function PrintCkListTables() you define a string variable ListSDGs and then use that as an argument to the function ReadQueryOfSDGs(), but ReadQueryOfSDGs() as written does not accept any arguments.  It's also not clear
    what ListSDGs represents...a list of files, names of queries? Also, the line
    For Each s In .selectedQuery in
    ReadQueryOfSDGs()
    references something called .selectedQuery which is undefined. 
    Is it that you want ReadQueryOfSDGs() to loop through the records returned by a query and add a field from each record to a collection?  If so, something like the following might better serve you:
    Public Function ReadQueryOfSDGs() As Collection
        Dim C As New Collection
        Dim rst As DAO.Recordset
        Set rst = DBEngine(0)(0).OpenRecordset("y_qs_DataIn_All_SDGList", dbOpenForwardOnly, dbReadOnly)
        Do Until rst.EOF
            C.Add rst!MyField ' where MyField is the field in y_qs_DataIn_All_SDGList you want to add to your collection
            rst.MoveNext
        Loop
        rst.Close
        Set rst = Nothing
        Set ReadQueryOfSDGs = C
    End Function

  • How to create User Defined Variables in Procurement Contract 12.1.3

    Hi,
    We are using Procurement Contract 12.1.3. As per our business requirement while creating contract template we need to use many variables which are not available in 'System Defined' variable list. Please guide us with some samples (step by step) how to create the 'User defined' variables.
    Regards,
    Prabhu

    Hi Prabhu,
    Did you get the setps how to create user defined variables in Procurement contracts? if so please share me the setp by step flow.
    Prakash

  • Sequence Quiz Using User Defined Variables - Can See Underlying Variable Name On Move

    I have just tested using 1 slide to capture several user defined variables and the next slide to insert those variables as options in a sequence quiz slide.
    This works but as soon as I grab an object to begin sequencing them the underlying variable name shows up alongside the variable content.
    Am wondering if I am attempting something that shouldn't be possible in Captivate and / or if there is a fix?
    Thanks

    Sure, I'm using Captivate 8. On a test project I've created:
    a slide with 2 text entry boxes, their contents are stored in variables
    another slide with a sequence question (using the native captivate question slide)
    The labels on the 2 sliders on the question slide use the variables from the previous slide.
    This works, so if the variables are as follows:
    $$data_sequence1$$ - "blah blah blah"
    $$data_sequence2$$ - "blah"
    The labels on the sliders on the sequence question will be "blah blah blah" and "blah".  as intended.
    The issue is when I click one of the sliders to drag it to sequence the variable name will flash up on screen. So if I touch the slider with the label "blah blah blah" $$data_sequence1$$ will flash up on screen.
    I have other slides on there but these are the two related to this question. I haven't fully published the project I've previewed it.

  • User-defined variable in selection variant - doesn't work?

    Hello,
    Anyone had any experience of using user-defined variables (type B) in a selection variant? I can't get this to work in 4.7 or ECC 6.0. Seems like a bug - there's no way to specify the name of the variable. The theory behind their use is fine, but I wonder if anyone has successfully used them?
    Thanks,
    Chris.

    In an ECC 5 system, I can get to these showing if I'm in a report selection screen and I use the "Goto > User variables" (or Ctrl-F6) option... but note that it will only show the menu option if there are report parameters that have a PID on them and where the PID is defined in table TUVID (see note 144459).  That said, personally I've only used the "T" option and maintained system wide values in table TVARVC.
    Jonathan

  • User-defined variables in Search Results pane

    I am working with user-defined variables for WebHelp output.
    I have successfully added the variables to the topic, the displayed
    topic title, the TOC, and the Index entries. The problems lies in
    getting the search output to display the specified variable text.
    For example, the base topic title is "Introduction to XX". I
    use a variable to change the XX to YY throughout the project;
    however, when I generate the output and then Search for YY, the
    search results pane displays "Introduction to XX" even though the
    displayed topic is titled, correctly, "Introduction to YY". I am
    assuming, because the topic title is not adhering to the variables,
    that the search results displays the metadata <title>.
    What should I do so the search results title syncs with the
    other data?
    Carol

    Welcome to the forum.
    There have been two posts about this recently so do a search
    for more information.
    Basically the search results show the Topic Title as defined
    in Topic Properties. Your variable is in the Topic Heading at the
    top of the page. Not the same thing.
    I suggest you request a feature change.
    http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

  • Where to maintain the user defined variables in Variant maintenace?

    In the variant maintenace screen, ther is provision for
    Type T - Table TVARVC entries
    Type D - Dynamic for date and time fields
    Type B - user defined
    My question :
    Where do you maintain the user defined variables?
    Pl advise.
    Thanks,
    Ven

    You may need to look into this link ( Its sap doc link)
    http://help.sap.com/saphelp_nw70/helpdata/en/c0/98039ee58611d194cc00a0c94260a5/content.htm

  • Is there any way to know that status of DEFINE variable?

    Hi,
    I have a list of scripts that is executed to create my baseline database. At the beginning of the script execution, we have a SET DEFINE OFF and at the end we put SET DEFINE ON. During one of the scripts, we deliberately SET DEFINE ON and we forgot to SET DEFINE OFF at the end of the script. Consequently, the following scripts started failing without error notification because they contained '&' in the INSERT query. I have the following queries:
    1. Is there any way to know the status of the DEFINE variable at the beginning of the script?
    2. Since the oracle gives a user interrupted error, the script execution process does not terminate with error. Instead, it continues executing the next scripts. Is there a general way to capture such errors and terminate the script execution. We already have WHENEVER SQLERROR and WHENEVER OSERROR in our script execution process.
    Regards
    Kunal

    Hi, Kunai,
    Welcome to the forum!
    953495 wrote:
    Hi,
    I have a list of scripts that is executed to create my baseline database. At the beginning of the script execution, we have a SET DEFINE OFF and at the end we put SET DEFINE ON. During one of the scripts, we deliberately SET DEFINE ON and we forgot to SET DEFINE OFF at the end of the script. Consequently, the following scripts started failing without error notification because they contained '&' in the INSERT query. I have the following queries:
    1. Is there any way to know the status of the DEFINE variable at the beginning of the script?Whether it's at the beginning of a script, later in the script, or not in a script at all, the SQL*Plus command
    SHOW DEFINEtells you if DEFINE is ON or OFF.
    If DEFINE is ON, it will produce something like:
    define "&" (hex 26)If DEFINE is OFF, it will produce
    define OFF
    2. Since the oracle gives a user interrupted error, the script execution process does not terminate with error. Instead, it continues executing the next scripts. Is there a general way to capture such errors and terminate the script execution. We already have WHENEVER SQLERROR and WHENEVER OSERROR in our script execution process.Do you really need to capture those errors? Why not just prevent them? It sounds like you want to make sure DEFINE is OFF at a certain point. To do that, just say
    SET  DEFINE  OFFRegardless of whether DEFINE was ON or OFF before you issue that command, you can be sure it will be OFF after that.
    I hope this answers your question.
    If not, post a complete test script (or set of scripts) that people can run to re-create the problem and test their ideas.
    Point out where the scripts you post are not doing what you want, and describe, with specific examples, what you want it to do in those places.

  • Newbie how to define variable of type element?

    JDEV 10.1.3.1
    When I perform the following from BPEL designer in JDEV...
    variable new
    create variable
    Select element type
    Select a local file schema xsd
    Select element of choice
    Seems to define OK but fails to compile. Namespaces appear to include the namespace defined in the xsd.
    When I define variables of type message and browse to the appropriate wsdl and pick a message from there this seems to work / compile just fine.
    I am sure that since I am just getting started that this is a common error, please assist and thanks. Must all variables be defined as message types and reside in a WSDL?
    Thanks,
    John

    Hello John,
    I'm not sure whether it is possible to import a schema into a process directly. What I usually do is to import it into the wsdl-file describing the process interface. This is the file you use to define the client-partnerlink. If your schema is imported correctly, you can access the type-definition via the partner-links-node in the type chooser (this works at least in JDEV 10.1.3.3 and 10.1.3.4).
    To import your schema into the wsdl, you need to go to the structure-view in wsdl-editor and after a right-click on the types-node select "insert types". Inside types you insert XML-Schema, inside schema you need to insert an import-tag. The properties for this tag are the file-location and the target namespace used in the schema. The resulting XML-structure should look like this:
    <wsdl:definitions xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/" xmlns:tns="http://xmlns.oracle.com/Order_Booking___Shipment" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="Order_Processing_SystemPLT" targetNamespace="http://xmlns.oracle.com/Order_Booking___Shipment">
    <wsdl:types>
    <schema xmlns="http://www.w3.org/2001/XMLSchema">
    <import schemaLocation="Order_Booking___Shipment.xsd"
    namespace="http://xmlns.oracle.com/Order_Booking___Shipment"/>
    </schema>
    </wsdl:types>
    </wsdl:definitions>
    Greetings,
    Christoph

  • Shared & user-defined variable behavior when they are passed an error?

    If a [TRUE] error condition is preset at its input terminal:
    What is the expected behavior for a shared variable which is being read?             My guess: To return the default value for the datatype being read.
    What is the expected behavior for a user-defined variable which is being read?     My guess: To return the default value for the datatype being read.
    What is the expected behavior for a shared variable which is being written?         My guess: To not update the value of the variable.
    What is the expected behavior for a user-defined variable which is being written? My guess: To not update the value of the variable.
    Are my guesses at the behavior correct?  If not, what is the real behavior?  This is for LabVIEW version 11 and newer.
    Thanks!
    Solved!
    Go to Solution.

    Thank you Arham!   I'm sorry you had to go to the trouble of creating a test VI to get the answer. I thought that this might have been documented somewhere and I was just missing it. It still may be documented somewhere but sometimes creating a test VI is the quicker path to an answer than is a search for where the documentation is stored and the test VI is probably the more conclusive answer anyway.
    In any case, thanks to your answer, it is now documented in a manner that should not be too hard for others to find, should they have the same question.
    Thanks again.

  • Pl/sql : bind, host & define variables

    what is difference between bind variable, host variable and define variable (i.e. variable created using DEFINE command) ? In what situation each of these variables are used?

    http://asktom.oracle.com
    for bind variable see the following link
    http://asktom.oracle.com/pls/ask/f?p=4950:8:4466155959264239264::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:668624442763,

Maybe you are looking for

  • Can you email out of a virtual app( PCHunter/Paralles) using Mac outlook 2011

    I'm interested in potentially running my PC product( PC Hunter) on a new MacBook Pro using Parallels. I currelty email out of the app via PC Outlook thus keeping all my email in one place. Does anyone have experience using a virtual PC product to ema

  • Itunes wont update--run prescript for apple mobile device

    My itunes update is hanging and I get the error "run prescript for apple mobile device..."  I cannot sync my ipad 3 w/o the update, so I am stuck.  Can someone help?

  • Problem to generate report

    i have prob to report generate(like a VB data report).Actually wht i want is to generate a report and to have a preview of the same and print also.If possible do sent me some code related to this problem or give me idea whwre i can get it. Thanks san

  • Testing ActionScript classes with native methods?

    Hi, I have an ActionScript class that I'm writing and would like to test using FlexUnit. The only issue is that the ActionScript class has a member in it that is a class with native methods. So, I get the following error when trying to run a test of

  • APEX  3.1.2 upgrade Question.

    Hi All, Currently we have APEX 3.0.1.00.08 on Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi Linux. Is it possible to upgrade to 3.1.2 on the same database? Is the any issues if I upgraded to 3.1.2? My current version of application