How to select values frm table giving the condition value at runtime in SQL

Hi All,
How to select values from a table by giving the condition value at runtime in SQL
My SQL statement is select * from employee where empno=<empno>, this empno I want to provide at run time. Also I don't have any bind variables defined. Can anyone please tell how can I achieve this. Also do I have to write a SQL or pl/sql statement.

Hi Roshni Shankar,
You can use substitution variable in case of SQL.
SQL> select * from employees where emplployee_id = &emp_id;
Enter value for emp_id: 100
old   1: select * from employees where emplployee_id = &emp_id
new   1: select * from employees where emplployee_id = 100If you want to put condition on varchar values then eighter provide values in single quotes or use single quote for substitution variable.
SQL> select * from employees where last_name = &emp_name;
Enter value for emp_name: 'King'
old   1: select * from employees where last_name = &emp_name
new   1: select * from employees where last_name = 'King'
no rows selected
SQL> select * from employees where last_name = '&e_name';
Enter value for e_name: King
old   1: select * from employees where last_name = '&e_name'
new   1: select * from employees where last_name = 'King'In case of pl/sql you can pass values to procedure and you can use those values at run time.
create or replace procedure test (p_emp_id number)
as
   v_last_name      varchar2(100);
begin
   select last_name
   into    v_last_name
   from  employees
   where employee_id = p_emp_id;
   dbms_output.put_line(p_emp_id ||'    ->    '||v_last_name);
end;
show errors
SQL>exec test(100);
SQL>exec test(101);Edited by: Gaurav Bhide on Oct 29, 2012 4:07 AM

Similar Messages

  • How can I build a table with the time values of a timer from a while loop

    Hi:
    I have a question concerning building a table:
    Every 100ms I read a value from a sensor (while loop with a timer). I would like to build a table with the actual time and the concerning value. For example:
    0msec         1V
    100msec     2V
    200msec     3V
    300msec     4V
    etc.
    If I use the Express VI for building a table, I always get the date and time, but I don't need the date and the time is in the following format: HH:MMS, which is nonsensical for me as I can't differentiate within msec. Can I change the format anywhere?
    Can I also save the table to a file or even to an Excelsheet? How can I do that?
    Thanks for your help!

    Hi Craig:
    thank you very much. To solve the mystery : ) :
    I want to drive a stepper motor with a specific frequency. To get the current degree value of the motor I would like to measure the current time (from the beginning of the move on). (With a formula I get the degree value out of the time)
    Concurrently I would like to get data from a torque sensor and from a pressure sensor. That's why I asked you about the time and the table. The measurement should start with the movement of the motor. How can I do that? Right now I have different block diagrams (different while loops) (see attachment) and I would like to put them in one.
    I haven't done the block diagram for the pressure sensor yet, so there is only the one for the torque sensor and the one for the motor.
    I also would like to set a mark in the table when the voltage value of an analog input gets under a specific threshold value. Is that possible?
    I'm sorry, I'm a novice in LabVIEW. But maybe you can help me.
    Thank you very much!
    Steffi
    Attachments:
    motor.vi ‏238 KB
    sensor.vi ‏59 KB

  • Which table stores the condition values of a purchase order line item?

    Hi,
    Please let me know the table that stores the condition values of purchase order line items(when we click on conditions tab after selecting an item then we can see the condition types and there is a corresponding condition value for that condition type.
    My requirement is to get the actual price for a purchase order line item(it can be seen in the last line and it is calculated after considering all the condition types) and display this value in a custom report.
    Thanks,
    Ravindra

    Hi Ravindra
    You can find the conditions data for PO in TAble KONV.
    KONV-KSCH is the condition type
    KONV-KWERT is  the cond value
    KONV-KNUMH is the condition doc no. which is there in EKKO field KNUMH.
    So u have to make a link between KONV-KNUMH and EKKO-KNUMH.
    Thanks
    Vijeta

  • How to create a temp table in the memory, not in disk?

    in sql server, you can create a temp table in the memory instead of disk,
    then you can do the insert, delete,update and select on it.
    after finishing, just release it.
    in Oracle,
    I am wonderfing how to create a temp table in the memory, not in disk?
    thanks,

    Thanks for rectifying me Howard.
    I just read your full article on this too and its very well explained here:
    http://www.dizwell.com/prod/node/357
    Few lines from your article
    It is true, of course, that since Version 8.0 Oracle has provided the ability to create a Keep Pool in the Buffer Cache, which certainly sounds like it can do the job... especially since that word 'keep' is used again. But a keep pool is merely a segregated part of the buffer cache, into which you direct blocks from particular tables (by creating them, or altering them, with the BUFFER POOL KEEP clause). So you can tuck the blocks from such tables out of the way, into their own part of the buffer cache... but that is not the same thing as guaranteeing they'll stay there. If you over-populate the Keep Pool, then its LRU mechanism will kick in and age its contents out just as efficiently as an unsegregated buffer cache would.
    Functionally, therefore, there can be no guarantees. The best you can do is create a sufficiently large Keep Pool, and then choose the tables that will use it with care such that they don’t swamp themselves, and start causing each other to age out back to disk.
    Thanks and Regards

  • How to fetch the condition value per line item in PO o/p

    Dear Experts ,
    I need to fetch the value of the all valid condition types in the PO item , for its o/p .
    For this i should know
    1.what all are the  condition types involved in the item .
    2.what is the condition rate
    3. what is the condition value .
      Pleas etell me how do i fetch this data ??
    Thanks in advance
    Regards
    Anis

    Hi Anis,
    At first collect the doc.condition-KNUMV from EKKO table.
    Later enter the above doc.condition no in KONV and KONP to get the details.
    Regards
    Ramesh Ch

  • How to handle vendor discounts based on the qty / value procured.

    Hello
           How to handle vendor discounts based on the qty / value procured.
    a.       Scenario: you have entered into a contract with vendor that you will buy goods worth Rs 10000/- and if you buy goods worth more than 100000 the vendor says he will give a discount of Rs 5000/- @ the end of the year.  
    i)                    How to handle this sceneriou2019s with SAu2019s
    ii)                   What does STD SAP offer.
    Regards
    Sapman man

    Hi,
    For the discucount condition type, you have to maintain scales.
    Take Condition type -  Discount Value ( RB00)
    Discount Value ( RB00) - Means Fixed discount. For this condition type, you have to maintain Scale basis as Value scale 'B' in the condition type customization.
    Transcation : M/06
    Select your condition type RB00 and click on the details icon.
    In the Scales block, you have to maintain and save.Calculation type = Fixed amount
    Scale basis = Value scale 'B'
    For this condition type, you have to maintain scales in the inforecord.
    Transcation : ME12
    Select this condition type, click on the Scales icon. There you have to maintain like
    From : 10,0000            Rate: 5000.
    It means, if the document value is reached 10,0000 then discount is 5000rs. If the value islessthen the 10,0000 then no discount.
    Regards
    KRK

  • How Can I Export A Table With Its Entries ( values )

    Hi guys,
    How can i export a table with the entries that the table is populated with ??!!
    Best Regards,
    Fateh

    To export a table and its data you can do it a number of ways.. Do you have access to SQL Developer? If not you can do it through the APEX SQL Workshop..
    Under SQL Workshop, Utilities, Data Unload, To text (or XML, whichever you are more comfortable with..).. Select your schema, click next button, select the table, click next, select the columns you want exported (select ALL ITEMS in the select List), click next, on optionally enclosed by I usually enter a " (Sometimes I have long strings in columns), click the include column names checkbox to get the column names at the top of the document, click unload data button..
    To get the ddl (code to build table) Sql Workshop, utilities, generate ddl, create script, select schema, select next, click table checkbox, select next, click the checkbox of table you want to get ddl for...
    Thank you,
    Tony Miller
    Webster, TX
    There are two kinds of pedestrians -- the quick and the dead.
    If this question is answered, please mark the thread as closed and assign points where earned..

  • How to query the condition value in VPRS

    Hello all,
    we provide the sales price to customers based on the condition value in "VPRS" ,because I have thousands of goods need the price,so I 'd like to make a query to extract the condition value in "VPRS".
    which table is refer to this?
    https://mnlylq.bay.livefilestore.com/y1mXNdIiY7VgiU1v3ymS71pxZluGxj4YNp4IFsyQEr1zkoxjm1VCsxpOgbBQ1-ucxiRtA9tC7O_3ZPaQa7qWKGbdnHNX8UzazWTlettENIO7iujggSx7vHjc2bvuIqhYFYb2DEgIjuNaJ5foKU_xF7wvA/%E5%9B%BE%E5%85%AD.jpg?psid
    Thanks,
    helai

    hi,
    For your Item category, if you check DETERMINE COST
    Determine cost
    Indicates whether, during pricing, the system determines the cost (stock value) of a sales document item.
    Use
    The system checks the cost determination indicator as a requirement before applying the condition type that calculates the cost (condition type VPRS in the standard version of R/3 1.1)
    Mainatin VPRS as D then it will automatically pull the price from Material master if maintained
    IF VPRS is getting determined, then in your pricing procedure, you can add markup (multiplier)

  • How to create a dynamic table were the JTable columns keep varying

    How to create a dynamic table were the JTable columns keep varying based on the input to the jtable

    Oooh, I lied. DefaultTableModel has an API for adding and
    removing columns. I didn't know that. You should have read
    the API.
    As for preferring to extend AbstractTableModel rather than
    DefaultTableModel, I think it's more correct. DefaultTableModel
    is a simple implementation of Abstract for basic cases. It isn't
    intended to be extended. I figure most people extending
    DefaultTableModel are also extending JFrame, JPanel, and Thread
    instead of encapsulating the first two and implementing
    Runnable for the third.

  • Changing the Condition value in Quatation only and not in Order

    Hi Gurus,
    We have a Requirement from Client in which the Client should be Able to change the condition Value PR00 in the Quotation and not in Sales order......can someone please let me know how's that possible?
    Because if we try to make Changes in Condition Type in V/06 it will also allow changes in Sales Order....

    Hi
    You can use user-exit USEREXIT_PRICING_PREPARE_TKOMP in the include MV45AFZZ.
    IF VBAK-AUART = (Your quotation type)
    LOOP AT XKOMV.
    IF XKOMV-KSCHL = 'PR00'.
    SELECT * FROM T685A INTO TABLE I_T685A WHERE KSCHL = 'PR00'.
    READ TABLE I_T685A WITH KEY KSCHL = XKOMV-KSCHL.
    I_T685A-KMANU = 'C'.
    MODIFY I_T685A INDEX SY-TABIX.
    MODIFY T685A FROM TABLE I_T685A.
    REFRESH I_T685A.
    ENDIF.
    ENDLOOP.
    like this discuss with your abapper and build the logic
    regards
    Prashanth

  • What are the condition value colours in sales oder  condition tab

    Hi SAP Guru's,
    I would like to know how many colours is their in for pricing condition values in sales order.And kindly explain the colours functionality.
    Thanks&Regards
    Vikram.M

    hi,
    Here are the steps.
    1.Create a Characteristic called ZColour(Standard SAP has a characteristic called colour.I did not use it.)
             Give your values.
             Say, Red  & Blue
    2.Now create another characteristic called ZCol_surcharge
    Give the description and go directly to Addnl Data Tab.Here in the table name Enter "SDCOM" and in the Field Name Enter "VKOND".The system will pick up the format from the Dictionary.
    3.Now go to CT04 and change the Characteristic Zcolour.
    Go to values tab and select RED.Goto Extras-> Object Dependencies->Editor and then select Procedure.
    In front of 000010 Enter  $self.ZCol_surcharge='RED'.
    Similarly Select Blue  and enter $self.ZCol_surcharge='BLUE'
    3.Link both these characteristics to the Class(The class which you have attached the KMAT Material).
    4.Go to VK11 and the Enter VA00.Then give the values RED and BLUE and enter the values.
    5.Go to your order and Enter your material.
    I think this is what you wnated..
    **IF YOU FEEL THIS IS USEFUL THEN JUST REWARD POINTS**

  • Pricing procedure  change the condition value

    Hi,
    My pricing procedure determines the Tax in %basis.Now i have a rewuirement wherein i should be able to enter the amount in AMOUNT COLOUMN in condition tab. This value should be the condition Value for the condition type.
    Now my pricing procedure doesnt allow me to make any changes and the condition type is greyed out. how can i calulate the tax in amount instead of % and be able to enter the value manually?
    Thanks,
    Challa

    Hi Challa,
    Price can be maintained either on percentage basis or on amount basis.
    So you have to make changes in condition type to convert it from percentage to amount.
    Go to IMG u2013 sales and distribution u2013 master data u2013 basic function u2013 pricing u2013 pricing control u2013 define condition type.
    Select maintain condition type from the options.
    Now select your condition type and click on detail.
    Change the calculation type from A (percentage) to B (Fixed amount) and save it.
    Now go to VK11 and maintain the new condition record for that condition type.
    Now create the sales order and go to condition tab and check out the pricing it will be amount.
    Please do this method if you find any difficulty then tell us.
    Regards
    Raj.

  • Print the conditions value in PO

    hi ppl,
             I want to print the conditions value in sap script.For this i need to start with the perform/form.so based on what value  and table i call pull the data..

    u need the table konv( conditions table ) by using ekko-knumv for that PO no.
    once u get knumv field frm ekko u can compare this with field knumv of konv.
    and based on this value the amount value wud be konv-kwert field.

  • Problem changing the Condition Value in Po using BAPI_PO_CHANGE

    Hi Experts,
    My issue is BAPI_PO_CHANGE is not changing the Condition value. and giving message in bapi return as 'cannot be processed manually'.
    Can anybody please help me on this.
    Thanks & Regards,
    Sudheer

    Check this link http://forums.sdn.sap.com/thread.jspa?threadID=652278
    Regards,

  • Any changes  in the condition value then system should trigger a mail.

    Hello Experts,
    I have below requirement
    If user does any changes (increase the price /decrease the price) in the condition value then system should trigger a mail and goes for approval.
    How i can achieve this ?
    Thanks

    Hi
    In that case again you can use MV45AFZZ program and USEREXIT_PRICING_PREPARE_TKOMP. If this exit didnt work you can try in other save or prepare to save exits in this same program. For order statuses and authorization you can use status profile and control authorization through an authorization object. For email use email sending function and users will receive an email whenever some specific condition value is changed.
    This will be ABAP coding in above mentioned program using implicit enhancement. There is no standard solution for this and you have to go for customization.
    Thank$

Maybe you are looking for

  • '*' in the file name

    hi SAP gurus Can u please explain me what if a file name in the sender or receiver configuration of the communication channel for example health*.txt.pgp thanks

  • Error in generating PDF Based form - SUI Report

    Hi, We are running Quarterly reports for Unemployment reporting at USA using tax reporter. We are not able to see the complete spool output for the Wage Type Listings but only just 1 page. In the tax reporter log we get the error "Error in generating

  • How get Required Number of Records

    I have to Tables stk_tble and pur_tble stk_tble containts current stock balance and pur_tble contains purchase detail select item_code,net_qty from  stk_tble where item_code='BS-1034W' ITEM_CODE              NET_QTY BS-1034W                     1 sel

  • I deleted my mail application

    I think I may have deleted my mail application. It would be nice if someone could help me. PLEAZ!?!?

  • Where is a file downloaded from yahoo, facebook, etc ?

    I usually use yahoo and my friend send me a file. How can I transfer it to my pc? Thanks