Help required in PLSQL Procedure.
Hi All,
I am writing a procedure in PLSQL, based on user input(user will input table name) we have to do a select * from table_name(input). How can we do this. Please suggest
Thanks and Regards,
Mahesh
Mahesh Ananth wrote:
Hi All,
I am writing a procedure in PLSQL, based on user input(user will input table name) we have to do a select * from table_name(input). How can we do this. Please suggestThis is generally bad practice so perhaps if you explain what you are trying to achieve in your business we can suggest a better way.
However, if you must..
SQL> ed
Wrote file afiedt.buf
1 create or replace procedure open_rc(p_table IN VARCHAR2, p_rc OUT sys_refcursor) is
2 begin
3 open p_rc for 'select * from '||p_table;
4* end;
SQL> /
Procedure created.
SQL> var x refcursor
SQL> exec open_rc('emp',:x);
PL/SQL procedure successfully completed.
SQL> print x;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
14 rows selected.
SQL> exec open_rc('dept',:x);
PL/SQL procedure successfully completed.
SQL> print x;
DEPTNO DNAME LOC
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
SQL>
Similar Messages
-
Hi all
I am a novice user , and I have some dumb question :
1.How do I create and execute plsql procedures in apex ??
2.I am not able to display anything in my regions or items using dbms_output.put_line('hello');
3.Is there any dummy's guide to plsql in apex ?? I could not find anything in the documentation that comes with apex.
Thanks & Regards
-Shantanu DhanukaHi,
PL/SQL is used throughout Apex applications and for various reasons, so it would not be possible to provide a simple answer!
There are various documents available from oracle.com. For example, here's a link to a document that explains many Apex concepts and provides simple instructions to follow. If you look at the bottom of the document you'll see how to output text on a page using PL/SQL:
http://download-uk.oracle.com/docs/cd/B31036_01/doc/appdev.22/b28550/ui.htm#BABGGACI
PL/SQL is an extensive language - I'm not sure that there is an on-line "Dummies guide" but here's another link that you could try:
http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14261/toc.htm
If you have specific tasks that you wish to perform and you believe that PL/SQL can help, please post a request for help in this forum explaining what you are trying to do.
Regards
Andy -
Help required in stored procedure?????
Hi,
I need to write a procedure in which a query is executed.I get a coulmn name as tel_no.it returns 75 telephone numbers.I need to return those numbers from procedure which follows below Criteria:
Select those numbers which have last 4 digits matching i,e last 3 digits are 444 or 333 or 999 etc.
if this criteria isnot met i need to choose whose send last 3 digits are matching i.e, last 4 digits like 3334 or 7775 or 1117 etc....Please do help..its very urgent.
the procedure takes 2 input...area_code and request_no.....
u may refer query as :
select area_name,tel_no, code from xyz where request_id=? and area_code=?
Please do tell me how will i do it...please......i will be thankful to u...
U may mail ur solution on [email protected]
Regards,
Megha Verma....Megha Verma wrote:
Hi,
I need to write a procedure in which a query is executed.I get a coulmn name as tel_no.it returns 75 telephone numbers.I need to return those numbers from procedure which follows below Criteria:
Select those numbers which have last 4 digits matching i,e last 3 digits are 444 or 333 or 999 etc.
if this criteria isnot met i need to choose whose send last 3 digits are matching i.e, last 4 digits like 3334 or 7775 or 1117 etc....Please do help..its very urgent.
the procedure takes 2 input...area_code and request_no.....
u may refer query as :
select area_name,tel_no, code from xyz where request_id=? and area_code=?What have you tried yourself so far?
If you want help, please provide your database version, some create table scripts and insert statements with example data, show what output is expected and detail any relevant business logic. And remember to include any code or data between {noformat}{noformat} tags (that's the word "code" between two curly brackets both before and after any text that need to retain it's formatting on the forum)
Please do tell me how will i do it...please......i will be thankful to u...
U may mail ur solution on [email protected].
Answers will be provided on the forum, not via email. That is the purpose of the forum as it's not a personal help desk.
Also, you may want to consider that this is a professional forum, so using IM speak ("u", "ur" etc.) is considered poor practice. Please use proper words. -
Help required for PLSQL or with some Analytical Function.
Hello All
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
I have couple of questions with following dataset and insert into a table
With t As
SELECT '2011' YR, FN1 File_name,1 rec_seq From Dual Union All
SELECT '2011' YR, FN1 File_name,2 rec_seq From Dual Union All
SELECT '2011' YR, FN1 File_name,3 rec_seq From Dual Union All
SELECT '2011' YR, FN1 File_name,4 rec_seq From Dual Union All
SELECT '2011' YR, FN1 File_name,5 rec_seq From Dual Union All
SELECT '2011' YR, FN1 File_name,6 rec_seq From Dual Union All
SELECT '2012' YR, FN1 File_name,7 rec_seq From Dual Union All
SELECT '2011' YR, FN1 File_name,8 rec_seq From Dual Union All
SELECT '2010' YR, FN1 File_name,9 rec_seq From Dual
SELECT C_CAND_ID,MAX(C_CAND_ID) OVER (PARTITION BY C_CAND_ID ORDER BY YR) FROM
SELECT DISTINCT COUNT(*) OVER (PARTITION BY YR ORDER BY FILE_NAME) "C_CAND_ID",
YR
FROM
(select YR, FIle_name
from t
How to find year which is not equal to count with maximum year (2011) and insert into errorlog table
How to find all distinct years --- 2011, 2012 and 2010 and insert into error log table
Target table is
Create table errorlog
(Error_code number,
Errorheader varchar2(100),
error_details varchar2(1000),
rec_sequence number
output is
errorcode errorheader errordetails rec_sequence
1 Year not as maximum count The year 2012 not equal to 2011 the max count 7
1 Year not as maximum count The year 2010 not equal to 2011 the max count 9
2 distinct years are the distinct years are 2010,2011,2012 0
also I have couple of other questions like
How to find YR with maximum number of records ----- the answer should be 2011.
How to find count of distinct years ---- the answer should be 3
Please give me some guidence or help
ThanksHow to find year which is not equal to count with maximum year (2011) and insert into errorlog table
How to find all distinct years Maybe following query gives you a start to identify the necessary information:
SQL> with t as
select '2011' yr, 'fn1' file_name,1 rec_seq from dual union all
select '2011' yr, 'fn1' file_name,2 rec_seq from dual union all
select '2011' yr, 'fn1' file_name,3 rec_seq from dual union all
select '2011' yr, 'fn1' file_name,4 rec_seq from dual union all
select '2011' yr, 'fn1' file_name,5 rec_seq from dual union all
select '2011' yr, 'fn1' file_name,6 rec_seq from dual union all
select '2012' yr, 'fn1' file_name,7 rec_seq from dual union all
select '2011' yr, 'fn1' file_name,8 rec_seq from dual union all
select '2010' yr, 'fn1' file_name,9 rec_seq from dual
select max (yr) keep (dense_rank last order by cnt_yr) over () max_cnt_yr, /* gives you the year with the most entries */
t.* /* rest of table */
from (select count (yr) over (partition by yr) cnt_yr, /* counts of a particular year ? */
count (distinct yr) over () cnt_distinct_yr, /* how many distinct years ? */
t.*
from t) t
MAX_CNT_YR CNT_YR CNT_DISTINCT_YR YR FILE_NAME REC_SEQ
2011 1 3 2010 fn1 9
2011 7 3 2011 fn1 2
2011 7 3 2011 fn1 3
2011 7 3 2011 fn1 4
2011 7 3 2011 fn1 6
2011 7 3 2011 fn1 1
2011 7 3 2011 fn1 5
2011 7 3 2011 fn1 8
2011 1 3 2012 fn1 7
9 rows selected. -
Help Required :Excel Upload Into Oracle Table Using PLSQL Procedure/Package
Please Help , Urgent Help Needed.
Requirement is to Upload Excel file Into Oracle Table Using PLSQL Procedure/Package.
Case's are :
1. Excel File is On Users/ Client PC.
2. Application is on Remote Server(Oracle Forms D2k).
3. User Is Using Application Using Terminal Server LogIn.
4. So If User Will Use to GET_FILE_NAME() function of D2K to Get Excel File , D2k Will Try to pick File from That Remote Server(Bcs User Logind from Terminal Server Option).
5. Cannot Use Util_File Package Or Oracle Directory to Place That File on Server.
6. we are Using Oracle 8.7
So Need Some PL/SQL Package or Fuction/ Procedure to Upload Excel file on User's Pc to Oracle Table.
Please Guide me wd some Code. or with Some Pl/SQL Package, or With SOme Hint. Or any Link ....
Jus help to Sort This Issue ........
you can also write me on :
[email protected], [email protected]I also Tried to Use This
But How can i Use SQLLDR Command In Stored Procedure.
Well IN SQL*PlUS it is successfull but in Stored Procedure /Package ,PL/SQL does not recognise the OS commands.
So now my Question How can I recognise the SQLLDR Commnad in Stored Procedure. -
Help Required:How Upload Excel file Into Oracle Table Using PLSQL Procedure
Please Help , Urgent Help Needed.
Requirement is to Upload Excel file Into Oracle Table Using PLSQL Procedure/Package.
Case's are :
1. Excel File is On Users/ Client PC.
2. Application is on Remote Server(Oracle Forms D2k).
3. User Is Using Application Using Terminal Server LogIn.
4. So If User Will Use to GET_FILE_NAME() function of D2K to Get Excel File , D2k Will Try to pick File from That Remote Server(Bcs User Logind from Terminal Server Option).
5. Cannot Use Util_File Package Or Oracle Directory to Place That File on Server.
6. we are Using Oracle 8.7
So Need Some PL/SQL Package or Fuction/ Procedure to Upload Excel file on User's Pc to Oracle Table.
Please Guide me wd some Code. or with Some Pl/SQL Package, or With SOme Hint. Or any Link ....
Jus help to Sort This Issue ........
you can also write me on :
[email protected], [email protected]TEXT_IO is a PL/SQL package available only in Forms (you'll want to post in the Forms forum for more information). It is not available in a stored procedure in the database (where the equivalent package is UTL_FILE).
If the Terminal Server machine and the database machine do not have access to the file system on the client machine, no application running on either machine will have access to the file. Barring exceptional setups (like the FTP server on the client machine), your applications are not going to have more access to the client machine than the operating system does.
If you map the client drives from the Terminal Server box, there is the potential for your Forms application to access those files. If you want the files to be accessible to a stored procedure in the database, you'll need to move the files somewhere the database can access them.
Justin -
Help with truncating a table using plsql procedure in different schema
I have a plsql procedure in schema A that truncates a table that is given in as parameter.
create or replace procedure truncate_table(schema, table_name)
EXECUTE IMMEDIATE 'TRUNCATE TABLE '||schema||'.'||table_name;
end;
The above procedure has public execute grant.
I need to truncate a table in schema B. I have a plsql procedure in schema B that calls the truncate_table procedure and passes in the schema B table name.
Since the table is in schema B, should the delete grant on the table be given to user A or user B to truncate the table in schema B?
Thanks in advance.Procedure created in schema A
create or replace
procedure truncate_table(l_schema varchar2, table_name varchar2) authid current_user
as
begin
EXECUTE IMMEDIATE 'TRUNCATE TABLE '||l_schema||'.'||table_name;
end;from schema B
grant delete on table1 to Schema_A
from schema A
exec truncate_table('Schema_B','Table1');
Hope this helps.
Alvinder -
Executing sql from table with in plsql procedure
I wonder if anyone can help.
I have a table that stores sql statements. They are actually a set of rules that I want to apply to my application. My intention is to execute the statement in plsql.
EG a sql statment held in the table might be:
'select count(id) from item where item_id = ' || constants_pkg.c_test_item || ' and client_id = ' || client_id_in
I am trying to call this from a plsql procedure, Ive CUT OUT some of the procedure task_rec.rule holds the statement above. The procedure is failing invalid SQL statement, I think the client_id_in may not be evaluating as the variable, passed into the procedure and constants_pkg.c_test_item not being taken from the constants pkg.
EG.
PROCEDURE create_additional_info_list(
client_id_in IN client.id%TYPE,
IS
result VARCHAR2(100);
BEGIN
EXECUTE IMMEDIATE
task_rec.rule
INTO result;
END;
If I was to do below the code would work ok. However I require the rule to come from the table.
EXECUTE IMMEDIATE
'select count(id) from item where item_id = ' || constants_pkg.c_test_item || ' and client_id = ' || client_id_in
INTO result;
Is there anyway constants_pkg.c_test_item and client_id_in can be evaluated as variables?Not that I've tried this but, if possible, change the SQL in the table to have bind variable; e.g.,
'select count(id) from item where item_id = :1 and client_id = :2 ';
Then in the procedure
execute immediate task
INTO result
USING constants_pkg.c_test_item ,
client_id_in ; -
Plsql procedure with sql query data
plsql newbie(learning sql): please excuse for asking a basic plsql question
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod on windows server 2003
PL/SQL Release 10.2.0.1.0 - Production
"CORE 10.2.0.1.0 Production"
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
CREATE OR REPLACE PROCEDURE p_check
AS
v1 NUMBER(20,0);
BEGIN
SELECT count(*) INTO v1
FROM ad_reg;
dbms_output.put_line(v1);
end;
inserts the number of rows in the table ad_reg into v1
and displays v1 by using dbms_output
i want my procedure to return table data
CREATE TABLE "TEST_SH"
"TEXT_ID" NUMBER,
"TEXT" CLOB
Insert into TEST_SH (TEXT_ID) values (1);
Insert into TEST_SH (TEXT_ID) values (2);
Insert into TEST_SH (TEXT_ID) values (3);
Insert into TEST_SH (TEXT_ID) values (4);
there will be a way with which i can see all the data(select * from test_sh) as the output of the plsql procedure
1.please tel me what to google
2.please guide me with a site or tell what is actually used and help me
3.or post an example here
thank you much
Edited by: 946207 on Nov 20, 2012 2:05 PM946207 wrote:
there will be a way with which i can see all the data(select * from test_sh) as the output of the plsql procedurePL/SQL is
a) nothing at all like T-SQL
b) two different languages, PL (Programming Logic) and SQL
SQL is used to access data in the Oracle database. So select * from test_sh is the correct statement to access the data.
The client can make execute this SQL statement itself. And view the data. However, this requires the client to understand the SQL language, and the database model. Which is typically not that you want. You want to abstract that from the client.
Why would you want the client to deal with the complexities of the SQL language? Or deal with the complexities of your database model in Oracle?
So instead of the client doing SQL, PL/SQL can do it on behalf of the client. The client uses PL/SQL as an API - in a similar fashion as the client would use any other API.
The PL/SQL code determines the SQL statement - and returns a SQL cursor handle to the client. The client then simply uses the SQL cursor that the PL/SQL code created for it (and the client needs to close the SQL cursor when done, so as to not cause server resource leakage).
E.g. (using PL/SQL as an API to abstract SQL and the data model)
create or replace procedure TestProc( c out sys_refcursor ) is
begin
open c for select * from test_sh order by 1;
end;The client then calls TestProc and gets a reference cursor handle. E.g. (the client call to Oracle):
begin
TestProc( c => :1 );
end;The client needs to supply a host (client language) bind variable of type cursor, as value for bind variable +:1+.
This is the correct way to deal with PL/SQL and cursors from a client GUI/language perspective. Any other method, like using PL/SQL to cache SQL data as a collection, is usually very wrong. -
PLSQL Procedure to invoke WebService
Hi,
We have a requirement to invoke a webservice(ESB\BPEL) using PLSQL Procedure.
we are trying to invoke service by getting details of service from a table like WSDL path, SOA Envelope and operation type.
If anybody has worked on the same requirements, please let us know ASAP.
With Regards,
Thanks
Message was edited by:
SOA Teamwe did some tests last week and we came up with this (I hope it helps) we are 10g so utl_dbws was already installed
function our_calculator(p_operator in varchar2,p_operand_1 in number,p_operand_2 in number)
return number as
the_service sys.utl_dbws.service;
the_call sys.utl_dbws.call;
the_url constant varchar2(256) := 'http://.../demo/soap/calculator_server.wsdl';
service_name constant sys.utl_dbws.qname := sys.utl_dbws.to_qname(null,'calculator_serverService');
operation_name constant sys.utl_dbws.qname := sys.utl_dbws.to_qname(null,'calculator_server');
input_params sys.xmltype;
the_result sys.xmltype;
begin
the_service := sys.utl_dbws.create_service(urifactory.geturi(the_url),service_name);
the_call := sys.utl_dbws.create_call(the_service,null,operation_name);
sys.utl_dbws.set_property(the_call,'OPERATION_STYLE','document');
input_params := sys.xmltype('<calculator xmlns="' || the_url || '">
<op>'||p_operator||'</op>
<p1>'||to_char(p_operand_1,'999999999.99')||'</p1>
<p2>'||to_char(p_operand_2,'999999999.99')||'</p2>
</calculator>');
the_result := sys.utl_dbws.invoke(the_call,input_params);
the_result := the_result.extract('//n:ret/text()','xmlns:n="' || the_url || '"');
sys.utl_dbws.release_call(the_call);
sys.utl_dbws.release_service(the_service);
return to_number(the_result.getstringval(),'999999999.99');
end;
[pre]
Regards
Etbin -
How to convert sql server procedure in to plsql procedure
hi guys
i have requirement where in i have to convert sql server procedure into plsql procedure.
can some one help me out .
thanks,
Vamshi.DHi Vamshi,
As you want to convert sql server procedure in to plsql procedure
i.e SQL SERVER ->ORACLE Right
FYI
SQL SERVER Proc. Syntax are totally different as compared to ORACLE Proc.
So, better you study Logic of SQL-SERVER Proc and convert into
Oracle Procedure.
Thanks,
Samadhan -
Tracing or debugging PLSQL Procedures
What kind of tracing or debugging is there available for PLSQL Procedures?
Kind regards,
Menk SlotThe OP has a venerable version of Oracle (8.0.1). Was DBMS_DEBUG available then, or was it introduced in 8i?
ANd of course DBMS_DEBUG is not a user-friendly API. It's a toolbox of components to help ISVs build a debugger. TOAD probably uses DBMS_DEBUG under the hood.
There's always the Devil's Debugger AKA DBMS_OUTPUT.PUT_LINE. Alternatively, learn to use utPLSQL to build unit tests. (This does work for pre-8i databases but make sure you read the requirements doc!)
Cheers, APC -
What is the purpose of Defining a requirement in the procedure?
Hi
I have a query related to the Output type .
What is the purpose of Defining a requirement in the procedure?
And where shall we code for a new requirement and also what shall we code in it?
Thanks<b>Requirement Use</b>
If the requirement is fulfilled (SY-SUBRC = 0), then output determination also takes into consideration output type or the access sequence, for which the requirement has been specified.
<u><b>Output determination:</b></u>
An object that checks whether the application data (for example, data determined in Customizing) corresponds to the condition records.
If this is the case, one or several messages are "found," which can then be processed (for example, sent electronically).
The condition records are searched for according to a predefined hierarchy in message determination.
After defining a new requirement no say 604 for billing pricing procedure and activating it, the standard sap system creates a routine with the no: 604 specifically for billing. So the name of the program automatically created by SAP will have the naming convention something like RV64A604. then you need an access key to go to the change mode for writing any logic. Then just put a break-point and then execute VF01 or VF04, then the cursor position directly goes into this routine, where the pricing structures KOMK and KOMP have the visibility. So based on the values flowing inside this structures, you can probably code that suites the business requirements.
there are some useful transactions like VOFM for maintaining the requirements and formulaes for a pricing procedure.
For viewing the requirements in the procedure you can also go to V/08 transaction.
Lakshminarayanan
P.S. Reward points for all helpful answers. -
Pricing Error (help required)
Is there any routine which includes the tax value in R100 as well ,currently the problem is that the 100% Discount condition is only including the net price
And in the pricing procedure i m using two prices one price of tax calculation and the other is consumer price first i calculate the tax from base price then i deduct the tax from the consumer price this calculation is working fine through standard routines.
Only problem is that when i enter NRAB and R100 at end it only includes Net Value which is calculated through Formual using condition type NTPS
Kindly Help Required ASAPHi ABAPAR,
I m not getting the exact picture of what U desired, from your pricing procedure.
As you r using multiple free goods condition type...anyway.
If you wanted to make the calculated tax "amount + "as a basis for the calculation of particular condition type.you can use the functionality of subtotal.
That mean go and assign one subtotal no. to subtotal column in your pricing procedur to all condition type to which you wanted to make as a basis for furthur calculation.(this settings allow the total of all values in one subtotal).
And finally U can assign this subtotal no.to the "alt.cal.B.value "of pricing procedure for the calculation of particular condition type.
If you r using any std condion type that come up with certain routine like NRAB or somthing...possibly that will not allow u to do this settings. so in this case clear your free goods requirement or use any new condition type. i.e . Z creation.
consult your SD consultant.
karnesh -
Calling PLSQL Procedure with CLOB input parameter from JDBC
Hi..
I've got a PLSQL procedure with a CLOB object as input parameter:
function saveProject (xmldoc CLOB) RETURN varchar IS
I want to call that procedure from my JDBC Application as...
String data = "..."
CallableStatement proc = conn.prepareCall
("begin ? := saveProject (?); end;");
neither
proc.setCharacterStream(2, new StringReader(data, data.length());
nor
proc.setString(2, data);
will work.
The Application throws java.sql.Exception: ... PLS-00306 wrong
number or types of arguments in call 'SAVEPROJECT'
How can I use set setClob method?
The Problem is: with Oracles CLOB implementation I can't create
an Instance, and from the CallableStatement a can't get a
Locator for a CLOB-Object.
This CLOB stuff makes me really nuts!
please somebody help me.. thanks
AlexHi All,
You can not make it like that.
You can not make clob as input parameter.
Do you want an easy way?
This is the easy way.
sample:
function myFunction(S varchar2(40))
return integer as
begin
insert into TableAAA values(S)
--TableAAA only contains 1 column of clob type
end;
This will work the problem with this is the parameter is in
varchar2 right? so there will be limited length for it.
You can do this to call that function:
nyFunction('My String that will be input into clob field');
There's another slight difficult way, I understand that you have
installed Oracle client/server in your system, try to look at
jdbc folder and try to find demo.zip in that folder, you can
find several ways of doing thing with jdbc.
Have a nice day,
Evan
Maybe you are looking for
-
Follow up doc in R/3 using action profile
Hi 1)How to create a follow up doc i.e billing doc in r/3 for sales order created in crm? 2) How to create a New Tab Using EEWB for Marketing campaign? its showing only basic data,channels... Regards, sanjana
-
Okay, I admit I'm a Windows User, the only Apple product I is an iPod 2 that was given to me. Apparently I *have to* use iTunes to put content on the iPad because Windows Explorer (Finder for you Apple-ites) only shows me the photos folder. I have 24
-
What's a loss how to respond when iPad?
What's a loss how to respond when iPad?
-
Post Author: ujain82 CA Forum: Desktop Intelligence Reporting Hello, I am using BO 6.1 I am having trouble creating pie chart. I am calculating different count values from different data providers. Now I need to create a pie chart showing the pr
-
I have a Macbook Air 2009 and I'm hoping to get the new 12 core Mac Pro 2010 when it arrives next week. I would like to Bootcamp to Windows 7 Home Premium on both machines and my question is what version to I need to get from Newegg.com? Do I need tw