Doubt in variables

hello experts
I got one problem.
I have report on customer sales according to various regions in a country.
the query is like
region,sales,....
and he have defined numbers for all sales regions...like 1 for kashmir,2 for delhi...
and I guess client have variable defined on region....so when he chooses 1 for region he gets kashmir region sales data,2 for delhi sales data....etc.....but he is fed up with remembering numbers of sales regions....so he want to see names of sales regions like delhi,kashmir when he is choosing in variable input....so it becomes easy for him....how can I help him?
thanks for your help
NR
Edited by: new rider on Dec 4, 2008 2:05 PM

Once he executes the query in analyzer.
He will get variable popup right. Go to region and press F4 (Select from list option).
Hope this helps.
Edited by: Praveen G on Dec 4, 2008 8:22 AM

Similar Messages

  • Doubt in Variable substitution

    Hi experts,
    Can i use variable substitution for taking a part of the input filename.
    My output filename contain only a part of the input filename.
    Regards,
    Divia

    >>With out storing the part of the input file name in a output files structure, is it not possible to achieve?
    You can use Dynamic Configuration UDF to set the file name instead of Variable substution.
    Have a look at Scenario #2 in my wiki [More with the File Adapter|https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/morewiththeFileAdapter]
    Thanks
    SaNv...

  • Doubt regarding variable CPIC_MAX_CONV = 500 setting.

    Hi Experts,
                         i have some confusion about setting below variable at R3 side or XI side ?
    set CPIC_MAX_CONV = 500 (WINDOWS)
    setenv CPIC_MAX_CONV 500 (unix)
    Thanks,
    Siva Grandhi

    Grandhi,
    You should set it in XI.
    Please check this threads where they discussed the same:
    Re: Setting Environment Variable CPIC_MAX_CONV
    Re: Error found in Communication channel monitoring ( component monitoring)
    Regards,
    ---Satish

  • Doubt on Variable Exit

    I have to modify small code which is currently having a bug.
    l_month(2) Type n.
    when 'ZI_3MCY'.
          clear loc_var_range.
          clear l_s_range.
          clear e_t_range.
          loop at i_t_var_range into loc_var_range
                        where vnam = '0P_CALYE'.
            l_fiscyear = loc_var_range-low(4).
           l_month = sy-datum+4(2).
            l_month = l_month - 2.
            if l_month = 0.
              l_month = 12.
              l_fiscyear = l_fiscyear - 1.
            elseif l_month = -1.
              l_month = 11.
              l_fiscyear = l_fiscyear - 1.
            endif.
            concatenate l_fiscyear l_month
               into l_s_range-high.
            l_month  = l_month - 2.
            if l_month = 0.
              l_month = 12.
              l_fiscyear = l_fiscyear - 1.
            elseif l_month = -1.
              l_month = 11.
              l_fiscyear = l_fiscyear - 1.
            ENDIF.
            concatenate l_fiscyear l_month into l_s_range-low.
            l_s_range-sign = 'I'.
            l_s_range-opt  = 'BT'.
            append l_s_range to e_t_range.
          ENDLOOP.
    if we are in Jan 2007 
    l_month = 01 - 02 =  -01
    but this is not taking minus one. it is taking 01 and skipping minus and skipping all the if conditions it has.
    i need some way to get minus over there. if i change the initalization of the l_month to  diffrent data type does this work . 
    Please can you give me a solution for this.
    Thanks
    Sharp

    Add another field of type 'I' to do the comparison and then set the value of l_month accordingly.
    l_month(2) Type n.
    i_month type i.
    when 'ZI_3MCY'.
          clear loc_var_range.
          clear l_s_range.
          clear e_t_range.
          loop at i_t_var_range into loc_var_range
                        where vnam = '0P_CALYE'.
            l_fiscyear = loc_var_range-low(4).
           l_month = sy-datum+4(2).
            i_month = l_month - 2.  ""
            if i_month = 0. ""
              l_month = 12.
              l_fiscyear = l_fiscyear - 1.
            elseif i_month = -1.  ""
              l_month = 11.
              l_fiscyear = l_fiscyear - 1.
            endif.
            concatenate l_fiscyear l_month
               into l_s_range-high.
            i_month  = l_month - 2. ""
            if i_month = 0. ""
              l_month = 12.
              l_fiscyear = l_fiscyear - 1.
            elseif i_month = -1. ""
              l_month = 11.
              l_fiscyear = l_fiscyear - 1.
            ENDIF.
            concatenate l_fiscyear l_month into l_s_range-low.
            l_s_range-sign = 'I'.
            l_s_range-opt  = 'BT'.
            append l_s_range to e_t_range.
          ENDLOOP.
    Changed lines in the code above are tagged with "".

  • ODI 11G Variable to Scenario???

    Hi all,
    i'm migrating some ODI 10g projects. I've a doubt about variable passed as parameters in 11g.
    I have a package called "MAIN" that makes some calls to other scenario stored in a variable "SCENARIO".
    In BOTH package i have a variable called "MY_VAR" that has been declared. In MAIN package i have also a refreshing step that calculate its value.
    After refreshing the author wanted to pass the calculate value to child scenario, for example
    OdiStartScen "-SCEN_NAME=#MY_PROJECT.SCENARIO"
    "-SCEN_VERSION=-1" "-MY_PROJECT.MY_VAR=#MY_PROJECT.MY_VAR"
    However this call doesn't work, in child scenario variable result with none value in History tab. THis call however is working in 10g...
    Any suggestion about what i'm missing?

    you don't see the value in "history tab", but are you sure that the value is not really passed ?
    Can you do a test using the "evaluate variable" tool in your child scenario
    for instance, if the refresh gives the value "A", you evaluate the variable in the child scenario like this :
    If = A then your set a tool (ex : sleep tool) named 'OK'
    If not, a tool named 'wrong value'

  • Static variable is single for class or single for JVM

    Hello,
    I have doubt, static variable is single for class or single for JVM. as per my knowledge static variable is single for class, but suposse i have an web application (war of an application ) i deployed the application twice with different context, supose yahoo and yahoo1. but the ditrectory structure and classes are same, if i have a statc variable in
    a classof an application, if i change the static variable of one class of an application wether it will change the static value of the class of another application.
    Example
              yahoo -> web-inf ->      classes ->MainPackage->     MyStaticClass->     static int i=9;
              yahoo1 -> web-inf ->      classes ->MainPackage->     MyStaticClass->     static int i=6;
              if i change the static value i in yahoo application to i=5;
              at the same time if i access the value i in yahoo1 application what i will get (wether 5 or 6).
    Thanks.

    A static variable is 'single' in its class.
    A Class is 'single' in its ClassLoader.
    There can be many ClassLoaders per JVM.
    There can be many applications per JVM. Each one generally has its own ClassLoader.
    Ergo there can be many instances of a Class, and therefore many instances of its static data.

  • Best practice for frequently needed config settings?

    I have a command-line tool I wrote to keep track of (primarily) everything I eat and drink in the course of the day.  Obviously, therefore, I run this program many times every day.
    The program reads a keyfile and parses the options defined therein.  It strikes me that this may be awfully inefficient to open the file every time, read it, parse options, etc., before even doing anything with command-line input.  My computer is pretty powerful so it's not actually a problem, per se, but I do always want to become a better programmer, so I'm wondering whether there's a "better" way to do this, for example some way of keeping settings available without having to read them every single time.  A daemon, maybe?  I suspect that simply defining a whole bunch of environment variables would not be a best practice.
    The program is written in Perl, but I have no objection to porting it to something else; Perl just happens to be very easy to use for handling a lot of text, as the program relies heavily on regexes.  I don't think the actual code of the thing is important to my question, but if you're curious, it's at my github.  (Keep in mind I'm strictly an amateur, so there are probably some pretty silly things in my code.)
    Thanks for any input and ideas.

    There are some ways around this, but it really depends on the type of data.
    Options I can think of are the following:
    1) read a file at every startup as you are already doing.  This is extremely common - look around at the tools you have installed, many of them have an rc file.  You can always strive to make this reading more efficient, but under most circumstances reading a file at startup is perfectly legitimate.
    2) run in the background or as a daemon which you also note.
    3) similar to #1, save the data in a file, but instead of parsing it each time save it instead as a binary.  If you're data can all be stored in some nice data structure in the code, in most languages you can just write the block of memory occuppied by that data structure to a file, then on startup you just transfer the contents of the file to a block of allocated memory.  This is quiet do-able - but for a vast majority of situations this would be a bad approach (IMHO).  The data have to be structured in such a way they will occupy one continuous memory block, and depending on the size of the data block this in itself may be impractical or impossible.  Also, you'd need a good amount of error checking or you'd simply have to "trust" that nothing could ever go wrong in your binary file.
    So, all in all, I'd say go with #1, but spend time tuning your file read/write proceedures to be efficient.  Sometimes a lexer (gnu flex) is good for this, but often times it is also overkill and a well written series of if(strncmp(...)) statements will be better*.
    Bear in mind though, this is from another amateur.  I c ode for fun - and some of my code has found use - but it is far from my day job.
    edit: *note - that is a C example, and flex library is easily used in C.  I'd be surprised if there are not perl bindings for flex, but I very rarely use perl. As an after thought, I'd be surprised if flex is even all that useful in perl, given perl's built-in regex abilites.  After-after-thought, I would not be surprised if perl itself were built on some version of flex.
    edit2: also, I doubt environment variables would be a good way to go.  That seems to require more system calls and more overhead than just reading from a config file.  Environment variables are a handy way for several programs to be able to access/change the same setting - but for a single program they don't make much sense to me.
    Last edited by Trilby (2012-07-01 15:34:43)

  • Invocation JVM and JNI library communication

    How do I communicate between my application that creates a VM, and the JNI libraries (with native functions) loaded by classes within the invoked VM?

    -Global variablesI doubt global variables inside the C app can be >accessed from JNI native methods.Whoops! Correct.
    -Primitives passed as argumentsSure, but there is an whole API in C I wan't to make
    available in Java.
    -Primitives as attributes in a classExplain? Attributes in class?Basically the same as the previous one. So probably no more useful.
    -C/C++ pointers passed as arguments or as class
    attributes using a java long to hold it.Yes, this is probably the way!You will probably find this is best.
    -Function callbacks.Presumably you control the code base for both sides of this. A JNI shared library can have normal shared library method calls in it. So use normal shared library protocols to access it. (I haven't tried it so there might be some interesting problems with initially resolving the thunks or there might not.)

  • About static

    hi friends,
    I have a doubt.Static variables or class variables are variables which are common to all objects,which implies class variables are blueprints charecteristics for the objects.
    So,I agree it should be acessed only by class name as Classname.Staticvariable
    but
    new Classname.staticvariable is also allowed which i strongly disagree bcoz we use object to change the class's charecteristics which is something not allowed.
    My doubt is why they are allowing to change

    public class StaticDemo {
    public static String STATSTRING = "I'm a static
    c string: use me without instantiating a StaticDemo
    object";
         public static void staticPrintMethod() {
    System.out.println("I was printed from a static
    ic method without object instantiation");
    System.out.println("I don't return any value as my
    my signature is 'void'");
         public static String getSTATSTRING() {
              return STATSTRING;
    public class Scaf {
         public static void main (String args[]) {
              //print static String
              System.out.println(StaticDemo.STATSTRING);
              System.out.println();
              //call staticPrintMethod()
              StaticDemo.staticPrintMethod();
              System.out.println();
              //call getSTATICSTRING()
              System.out.println(StaticDemo.getSTATSTRING());
    }these two examples should help...I dont mean it should not be modified but i mean it should not be allowed to be modified using instance,
    as
    new StaticDemo().STATSTRING="hi";

  • Doubt about  a null value assigned to a String variable

    Hi,
    I have a doubt about a behavior when assigning a null value to a string variable and then seeing the output, the code is the next one:
    public static void main(String[] args) {
            String total = null;
            System.out.println(total);
            total = total+"one";
            System.out.println(total);
    }the doubt comes when i see the output, the output i get is this:
    null
    nulloneA variable with null value means it does not contains a reference to an object in memory, so the question is why the null is printed when i concatenate the total variable which has a null value with the string "one".
    Is the null value converted to string ??
    Please clarify
    Regards and thanks!
    Carlos

    null is a keyword to inform compiler that the reference contain nothingNo. 'null' is not a keyword, it is a literal. Beyond that the compiler doesn't care. It has a runtime value as well.
    total contains null value means it does not have memory,No, it means it refers to nothing, as opposed to referring to an object.
    for representation purpose it contain "null"No. println(String) has special behaviour if the argument is null. This is documented and has already been described above. Your handwaving about 'for representation purpose' is meaningless. The compiler and the JVM don't know the purpose of the code.
    e.g. this keyword shows a hash value instead of memory addressNo it doesn't: it depends entirely on the actual class of the object referred to by 'this', and specifically what its toString() method does.
    similarly "total" maps null as a literal.Completely meaningless. "total" doesn't 'map' anything, it is just a literal. The behaviour you describe is a property of the string concatenation operator, not of string literals.
    I hope you can understand this.Nobody could understand it. It is compete nonsense. The correct answer has already been given. Please read the thread before you contribute.

  • Static method and variables doubts

    i have a doubt
    i have the following method
    private static void checkActionType(String action) {
    if (action.startsWith(" a")) {
    ++totalAddedActions;
    } else if (action.startsWith(" c")) {
    ++totalChangedFolders;
    } else if (action.startsWith(" p")) {
    ++totalPersonalizedActions;
    } else if (action.startsWith(" r")) {
    ++totalRemovedActions;
    } else if (action.startsWith(" v")) {
    ++totalViewedActions;
    } else if (action.startsWith(" u")) {
    ++totalUpdateActions;
    to use it, i need to declare my int variables static, because im calling this method from another static method that is called by main method.
    but this can cause me problems ?
    if i have two instances of this class running, my statics int will show the right value?
    there is a better approach?

    Here is my class, i want some advices to know if i am doing right, because everything is a little new for me.
    My class, read a log file and based upon a regular expression, it can retrieve a general statistic or a personal statistic.
    package br.com.organox.aggregator;
    import java.io.BufferedReader;
    import java.io.FileReader;
    import java.io.IOException;
    import java.util.Vector;
    import org.apache.oro.text.regex.*;
    public class LogFileReader {
    private static Pattern regexpPattern;
    private static PatternMatcher patternMatcher;
    private static PatternCompiler patternCompiler;
    private static PatternMatcherInput patternInput;
    private static MatchResult matchResult;
    private static final String patternString = "^[^\']+User\\s+\'([^\']+)\'[^\']+session\\s+\'([^\']+)\'\\s+(\\S+)";
    // Integers used to store number of user, sessions and specific actions
    private static int totalUsers;
    private static int totalSessions;
    private static int totalAddedActions;
    private static int totalChangedFolders;
    private static int totalPersonalizedActions;
    private static int totalRemovedActions;
    private static int totalUpdateActions;
    private static int totalViewedActions;
    public static void main(String[] args) {
    if (args.length == 0) {
    System.out.println("No file name was specified");
    printClassUsage();
    } else if (args.length == 1) {
    printGeneralData(args[0]);
    } else if (args.length == 2) {
    System.out.println("You must set file name, data value and data type in order to " +
    "this class run properly");
    printClassUsage();
    } else {
    printSelectedData(args[0],args[1],args[2]);
    public static void printGeneralData(String fileName) {
    String data = "";
    //Users and the Session Vector are used to avoid count repeated values.
    Vector usersVector = new Vector();
    Vector sessionVector = new Vector();
    patternCompiler = new Perl5Compiler();
    patternMatcher = new Perl5Matcher();
    try {
    regexpPattern = patternCompiler.compile(patternString);
    } catch (MalformedPatternException mpe) {
    System.out.println("Error Compiling Pattern");
    System.out.println(mpe.getMessage());
    try {
    FileReader fileRead = new FileReader(fileName);
    BufferedReader buffRead = new BufferedReader(fileRead);
    while ((data = buffRead.readLine())!= null) {
    patternInput = new PatternMatcherInput(data);
    while(patternMatcher.contains(patternInput,regexpPattern)) {
    matchResult = patternMatcher.getMatch();
    // Avoid to insert repeated data in user and session Vectors
    if (usersVector.lastIndexOf(matchResult.group(1)) == -1) {
    usersVector.add(matchResult.group(1));
    if (sessionVector.lastIndexOf(matchResult.group(2)) == -1) {
    sessionVector.add(matchResult.group(2));
    increaseActionType(matchResult.group(3));
    for (int i=0;i<usersVector.size();i++) {
    totalUsers++;
    for (int i=0;i<sessionVector.size();i++) {
    totalSessions++;
    fileRead.close();
    buffRead.close();
    } catch (IOException ioe) {
    System.out.println("An I/O error occurred while getting log file data");
    ioe.printStackTrace();
    System.out.println("Users logged : " + totalUsers);
    System.out.println("Sessions opened : " + totalSessions);
    System.out.println("Added contents : " + totalAddedActions);
    System.out.println("Changed folders : " + totalChangedFolders);
    System.out.println("Personalized contents : " + totalPersonalizedActions);
    System.out.println("Removed contents : " + totalRemovedActions);
    System.out.println("Viewed Contents : " + totalViewedActions);
    System.out.println("Updated contents : " + totalUpdateActions);
    public static void printSelectedData(String fileName,String value,String valueType) {
    String data = "";
    String user = "";
    //Flag used to print the right result on screen
    String printFlag = "";
    Vector sessionVector = new Vector();
    Vector userVector = new Vector();
    Vector actionVector = new Vector();
    patternCompiler = new Perl5Compiler();
    patternMatcher = new Perl5Matcher();
    try {
    regexpPattern = patternCompiler.compile(patternString);
    } catch (MalformedPatternException mpe) {
    System.out.println("Error Compiling Pattern");
    System.out.println(mpe.getMessage());
    try {
    FileReader fileRead = new FileReader(fileName);
    BufferedReader buffRead = new BufferedReader(fileRead);
    while ((data = buffRead.readLine())!= null) {
    patternInput = new PatternMatcherInput(data);
    while(patternMatcher.contains(patternInput,regexpPattern)) {
    matchResult = patternMatcher.getMatch();
    if (valueType.equalsIgnoreCase("-user")) {
    printFlag = "userPrint";
    if ((matchResult.group(1).equalsIgnoreCase(value))) {
    userVector.add(matchResult.group(1));
    // avoid insert a repeated value inside session vector.
    if (sessionVector.lastIndexOf(matchResult.group(2)) == -1) {
    sessionVector.add(matchResult.group(2));
    increaseActionType(matchResult.group(3));
    if (userVector.size() == 0) {
    printFlag = "userPrintError";
    } else if (valueType.equalsIgnoreCase("-session")) {
    printFlag = "sessionPrint";
    if ((matchResult.group(2).equalsIgnoreCase(value))) {
    user = matchResult.group(1);
    sessionVector.add(matchResult.group(2));
    increaseActionType(matchResult.group(3));
    if (sessionVector.size() == 0) {
    printFlag = "sessionPrintError";
    } else if (valueType.equalsIgnoreCase("-action")) {
    printFlag = "actionPrint";
    if ((matchResult.group(3).equalsIgnoreCase(value))) {
    if (userVector.lastIndexOf(matchResult.group(1)) == -1) {
    userVector.add(matchResult.group(1));
    actionVector.add(matchResult.group(3));
    if (actionVector.size() == 0) {
    printFlag = "actionPrintError";
    fileRead.close();
    buffRead.close();
    } catch (IOException ioe) {
    System.out.println("An I/O error occurred while getting log file data");
    ioe.printStackTrace();
    if (printFlag.equals("userPrint")) {
    for (int i=0;i<sessionVector.size();i++) {
    totalSessions++;
    System.out.println("Sessions opened by user " + value + " : " + totalSessions);
    System.out.println("Added contents by user " + value + " : " + totalAddedActions);
    System.out.println("Changed folders by user " + value + " : " + totalChangedFolders);
    System.out.println("Personalized contents by user " + value + " : " + totalPersonalizedActions);
    System.out.println("Removed contents by user " + value + " : " + totalRemovedActions);
    System.out.println("Viewed contents by user " + value + " : " + totalViewedActions);
    System.out.println("Updated contents by user " + value + " : " + totalUpdateActions);
    } else if (printFlag.equals("userPrintError")) {
    System.out.println("This user " + value + " was not found on log file");
    } else if (printFlag.equals("sessionPrint")){
    System.out.println("Session " + value + " was opened by user " + user);
    System.out.println("Added contents by session " + value + " : " + totalAddedActions);
    System.out.println("Changed folders by session " + value + " : " + totalChangedFolders);
    System.out.println("Personalized contents by session " + value + " : " + totalPersonalizedActions);
    System.out.println("Removed contents by session " + value + " : " + totalRemovedActions);
    System.out.println("Viewed Contents by session " + value + " : " + totalViewedActions);
    System.out.println("Updated contents by session " + value + " : " + totalUpdateActions);
    } else if (printFlag.equals("sessionPrintError")){
    System.out.println("This session " + value + " was not found on log file");
    } else if (printFlag.equals("actionPrint")){
    System.out.println("Action " + value + " was performed " + actionVector.size() +
    " times for " + userVector.size() + " different user(s)");
    } else if (printFlag.equals("actionPrintError")){
    System.out.println("This action " + value + " was not found on log file");
    } else {
    System.out.println("Wrong search type!");
    System.out.println("Accepted types are: ");
    System.out.println("-user -> Search for a specified user");
    System.out.println("-session -> Search for a specified session");
    System.out.println("-action -> Search for a specified action");
    private static void increaseActionType(String action) {
    if (action.startsWith("a")) {
    ++totalAddedActions;
    } else if (action.startsWith("c")) {
    ++totalChangedFolders;
    } else if (action.startsWith("p")) {
    ++totalPersonalizedActions;
    } else if (action.startsWith("r")) {
    ++totalRemovedActions;
    } else if (action.startsWith("v")) {
    ++totalViewedActions;
    } else if (action.startsWith("u")) {
    ++totalUpdateActions;
    }

  • Doubt in printing variables in script

    Hi Experts,
    I am having small doubt.
    1).I need to write one condition for sales org 'US11' and divisions '20' or '40'. So the below logic is correct or not.
    if vbdkr-vkorg = 'US11' and and vbdkr-vtweg = '20' or vbdkr-vtweg = '40'.
    select........
    endif.
    2). i need th print these variables in script. can i use the logic like this.
    if &vbdkr-vkorg& = 'US11' and and &vbdkr-vtweg& = '20' or &vbdkr-vtweg& = '40'.
    &zkbetr1/ zpery1&
    else.
    &zkbetr/ zpery& (This is for sales org other than US11)
    endif.
    Thanks & Regards,
    Ramana.

    Hi,
    I think your condition would be more apt if you code this way:
    IF vbdkr-vkorg EQ 'US11' AND ( vbdkr-vtweg EQ '20' OR vbdkr-vtweg EQ '40' ).
    ENDIF.
    Also, look at putting the code into a subroutine called from your driver or subroutine program and then returning the value. The "logic" for determining the value to be printed can then be performed within the subroutine rather than the SAP script.
    Cheers,
    Aditya

  • Doubt about scope of instance variable

    Hi All,
    i have a doubt about scope of instance variable.
    if i declare a instance variable in servlet , i want to know whether it can be shared(means everywhere ) or not.
    thanks in advance
    Gopal

    The servlet container will create one servlet object, and run multiple threads through its service() / doGet() / doPost() methods.
    That means that any instance variables of the servlet are shared between multiple requests, and can cause problems with threads accessing the same variable..
    To make your servlets thread-safe
    1 - have no instance variables - only use local variables in the doGet/doPost method.
    2 - use the session scope for storing variables you need over multiple calls.
    Cheers,
    evnafets

  • Small doubt on displaying variables in sap script

    HI all,
    Can anyone let me know if i am in the correct way or not.
    i'm modifying one existing script. to display some data in the script i am doing like this :
    get the data into itab.
    loop at itab into wa.
    call FM write_form
       element = 'TEXT'.
    endloop.
    in the layout i am using this elements and variables
    /E TEXT
    S1 <D1>&WA-FIELD1&</> <D1>&WA_FIELD2&</>
    but the work in not having any data in the layout whereas before call write_form its having data.
    can anyone suggest me who to deal with this.
    thanks

    You can check if your SAPScript is able to talk with the driver program.
    In SE71
    Open in Change Mode
    Form > Check > Text
    Select the Include Res checkbox .. Press Enter
    Enter your Program in the Next popup by "Append Print Program"
    Now, press Copy.
    It will show you the errors.
    In your proram WA must a in TOP include or Globally declared.
    Regards,
    Naimesh Patel

  • Doubt in Decode and Using Temporary variable

    I was facing the following issue,
    For example,
    The column_name if A should be stored with the value B or, with itself for which I included a statement as following,
    Case [1]
    SELECT ....DECODE(column_name,'A','B',column_name) alias_name
         FROM table_name
              WHERE condition;
    But,
    when i used a temporary variable as following i could not get the expected change,
    Case [2]
    SELECT ...column_name
         FROM table_name
              WHERE condition;
    temp VARCHAR(10);
    BEGIN
    IF column_name='A' THEN
         temp:='B';
    ELSE
         temp:=column_name;
    END IF;
    END;
    I was able to get the right output in Case[1],but failed to get in [2]. Please help and Thanks in advance.

    Without seeing your code, whatever I can say might be just an assumption. I can give an example to show that it will work.
    SET SERVEROUTPUT ON
    DECLARE
      var      VARCHAR2(10);
      col_name VARCHAR2(30);
      TEMP     VARCHAR2(20);
    BEGIN
      SELECT column_name
      INTO col_name
      FROM user_tab_columns
      WHERE table_name = 'EMP'
      AND rownum       =1;
      IF (col_name     ='EMPNO') THEN
        temp          := 'X';
      ELSE
        temp := col_name;
      END IF;
      var := 'abc '||temp;
      dbms_output.put_line(var);
    END;
    OUTPUT :
    abc X
    PL/SQL procedure successfully completed.

Maybe you are looking for