How to run this query correctly?
Hi Sir,I use a query that I converted from sql to oracle but in error.
Error (4.3): PLS-00428: an INTO clause in this SELECT statement
Here's my query:
SELECT distinct Code pa.id, pa. Empcode Emp_ID, E.Emp_FirstName | ' ' || E.Emp_LastName Emp_Name, pa. Work Date1 date, pa. InPunch In_Punch, pa. OutPunch Out_Punch, pa.approve, ls. Leave_Status_text StatusText, NVL (pt.punchtype, 'day') JOIN employee E ON PunchForApproval pa e.Emp_ID punchtype is pa. Empcode LEFT JOIN Leave_status ls TO ls. Leave_Status_id = pa.approve LEFT JOIN punchtype pt ON pt.id = pa. STATUS
WHERE E.Emp_ID IN (SELECT Emp_id FROM employee) ORDER BY pa.id DESC;
Thank you
Hello
You run this in a PL/SQL procedure? If so, what the procedure called the request?
Also, did you see the error even if you add a space to the request here.
WHERE E.Emp_ID IN (SELECT Emp_id FROM employee) ORDER BY pa.id DESC;
-implement-
WHERE E.Emp_ID IN (SELECT Emp_id FROM employee) ORDER BY pa.id DESC;
Kind regards
Mike
Tags: Database
Similar Questions
-
Hello
I have a form based on the table that store only 1 card. I have created a form page, but may not know how to run the query and display the record in the table. If there is no record in the table, I want that the user can use this page to create a record.
Thanks in advance
NRIHello Nri,
What value does P18_SCHOOL_ID?
If you look at the State of Session (toolbar) developer. If that does not have a value, it's your problem.You can create a calculation before the process that gives the correct value. (In one case more often, you have a report and when you click on the link change that id is activated and you see the recording in your form)
Dimitri
-
How to optimize this query?
Hello
I have a query like this:
Merge into the table st1
using (select * from (select pk, value, diff_value, m_date, row_number () over (PARTITION pk ORDER BY diff_value) rnk)
from (select distinct / * + Full (t1) full (t2) * / t1.pk, t2.m_date)
, Case when (t1.m_date = t2.m_date) then "CORRESPONDENCE".
When (t2.m_date BETWEEN t1.m_date-1 and t1.m_date + 1) then ' MATCHED WITH +/-1gg.
When (t2.m_date BETWEEN t1.m_date-2 and t1.m_date + 2) then "MATCHED WITH +/-2 days.
else "
end value_match
Case when (t1.m_date = t2.m_date) then 0
Where (t2.m_date BETWEEN t1.m_date + 1 and t1.m_date - 1) then 1
Where (t2.m_date BETWEEN t1.m_date + 1 and t1.m_date - 1) then 2
else "
end diff_value
of table t2, t1 table
where t1.value is null
and t1.id = t2.id)
where value_match is not null)
where rnk = 1) s
on (st1.pk = s.pk)
WHEN MATCHED THEN
Update set st1.value = s.value_match, st1.diff_value = s.diff_value, st1.up_date = s.m_date
where st1.value is null.
Explain the plan:
Table1 a record 3Million and table 2 has 1 million records.
I used gather stats before you run this query and 'Full' trick, even in this case, he is running for 45 minutes.
Please suggest the best solution to optimize this query.
Thanks in advance.
Remove the tips.
No need for the separate.
Get the diff by ceil (abs(t2.m_date-t1.m_date)) and the filter for that where value_diff<>
Assing the statement ".. MATCHED" lately in the update clause.
Maybe give exactly to your needs with a small example may be the query may be getting more simplified or not what you want it to do.
-
No idea how to write this query
Hi, My Data is as below
DocNum doc_date type of amount
1154 15 November 11 232501.5 invoice
200206 4 November 11 - 243672.64 credit memo
Note flow 111 5 November 555.22 11
Output must be
DocNum doc_date amount Type AmountDR AmountCR
1154 232501.5 15 November 11 Bill 232501.5
Note credit 200206 4 November 11 - 243672.64 - 243672.64
Note flow 111 5 November 555.22 11 555.22
If the amount is > 0, then it must be displayed in the value of the amount to be AmountDR
If amount < 0 then it must be displayed in the value of the sum amount CR
Can help how to write this querywith sample_table as ( select 1154 Docnum,date '2011-11-15' doc_date,232501.5 Amount,'Invoice' type from dual union all select 200206,date '2011-11-04',-243672.64,'Credit Memo' from dual union all select 111,date '2011-11-05',555.22,'Debit Memo' from dual ) select Docnum, doc_date, Amount, type, case when Amount >= 0 then Amount end AmountDR, case when Amount < 0 then Amount end AmountCR from sample_table / DOCNUM DOC_DATE AMOUNT TYPE AMOUNTDR AMOUNTCR ---------- --------- ---------- ----------- ---------- ---------- 1154 15-NOV-11 232501.5 Invoice 232501.5 200206 04-NOV-11 -243672.64 Credit Memo -243672.64 111 05-NOV-11 555.22 Debit Memo 555.22 SQL>
SY.
-
How to rewrite this query to get the correct results?
Friends,
DB: 9iR2
I need to get the name of the employee and the employee number that are not in the table of presence.
but this query is not the right answer.
Thank youselect e.eno,e.ename from empl e where e.eno not in (select a.eno from attendance a)
Depending on your data
SQL> create table attendance( 2 ENO VARCHAR2(5), 3 TDATE VARCHAR2(10), 4 IN_TIME VARCHAR2(6), 5 OUT_TIME VARCHAR2(6), 6 SHIFT_NO NUMBER(1)); Table created. SQL> create table empl( 2 ENO VARCHAR2(5), 3 ENAME VARCHAR2(75)); Table created. SQL> insert into empl values('11','AA'); 1 row created. SQL> insert into empl values('12','AB'); 1 row created. SQL> insert into empl values('13','AC'); 1 row created. SQL> insert into empl values('14','AD'); 1 row created. SQL> insert into empl values('15','AF'); 1 row created. SQL> insert into attendance values('11','23-3-2009','9.00','6.00',1); 1 row created. SQL> insert into attendance values('14','24-3-2009','9.00','6.00',1); 1 row created. SQL> insert into attendance values('11','25-3-2009','9.00','6.00',1); 1 row created. SQL> insert into attendance values('13','23-3-2009','9.00','6.00',1); 1 row created. SQL> insert into attendance values('15','23-3-2009','9.00','6.00',1); 1 row created. SQL> commit; Commit complete. select e.eno,e.ename from empl e where not exists(select 1 from attendance a where a.eno=e.eno); ENO ENAME 12 AB
Twinkle
-
How to write this query in the hierarchy
Hi gurus,
Really need your help on this query. Thank you very much in advance.
SELECT t1.key as root_key , (SELECT t2.unit_id AS unit_id level-1 AS level , t2.name, t2.creator FROM tab t2 START WITH t2.unit_id = t1.unit_id -----check each node as root CONNECT BY prior t2.unit_id = t2.parent_unit_id ) t1.name as parent_unit_name FROM tab t1
I'll write a query of the hierarchy as above, and that EACH line (node, totally more than 10200) is checked as root node to see how many sheets are accessible for her... It must be implemented in a single query.
I know inline query should NOT return multiple rows or multiple columns, but the inline elements are necessary and can certainly be made in a correct solution.
(env):
Database Oracle 12 c Enterprise Edition Release 12.1.0.2.0 - 64 bit Production
PL/SQL Release 12.1.0.2.0
)
Test data:
select 1 as unit_id, null as parent_organization_unit_id, 'U1' as name from dual union all select 2, 1, 'U2' FROM DUAL UNION ALL SELECT 3, NULL, 'U3' FROM DUAL UNION ALL SELECT 4, 3, 'U4' FROM DUAL UNION ALL SELECT 5, 2, 'U5' FROM DUAL UNION ALL SELECT 6, 5, 'U6' FROM DUAL UNION ALL SELECT 7, 6, 'U7' FROM DUAL UNION ALL SELECT 8, 5, 'U8' FROM DUAL UNION ALL SELECT 9, 5, 'U9' FROM DUAL;
Final result should be like this
key unit_id, level, name, parent_name 1 1 0 u1 u1 1 2 1 u2 u1 1 5 2 u5 u1 1 6 3 u6 u1 1 7 4 u7 u1 1 8 3 u8 u1 1 9 3 u9 u1 2 2 0 u2 u2 2 5 1 u5 u2 2 6 2 u6 u2 2 7 3 u7 u2 2 8 2 u8 u2 2 9 2 u9 u2
Don't know how get you your output, it does not match your data...
with tab as)
Select 1 as unit_id, null as parent_organization_unit_id 'U1' as the name of double
Union of all the
Select 2, 1, 'U2' FROM DUAL
UNION ALL
SELECT 3, NULL, 'U3' FROM DUAL
UNION ALL
SELECT 4, 3, 'U4' FROM DUAL
UNION ALL
SELECT 5, 2, 'U5' OF THE DOUBLE
UNION ALL
SELECT 6, 5, 'U6' OF THE DOUBLE
UNION ALL
SELECT 7, 6, "U7" OF THE DOUBLE
UNION ALL
SELECT 8, 5, 'U8' FROM DUAL
UNION ALL
9. SELECT, 5, 'U9' FROM DUAL
)
Select dense_rank() key (order by connect_by_root unit_id), unit_id, level - 1 as 'LEVEL', connect_by_root name root_parent_name
t tab
Start with parent_organization_unit_id is null
Connect prior unit_id = parent_organization_unit_id
KEY UNIT_ID LEVEL ROOT_PARENT_NAME 1 1 0 "U1". 1 2 1 "U1". 1 5 2 "U1". 1 6 3 "U1". 1 7 4 "U1". 1 8 3 "U1". 1 9 3 "U1". 2 3 0 "U3". 2 4 1 "U3". -
How to write this query?
Hi people,
I need to get a query in which a set of records, I get ONLY those which previous registry has a field with a value to this topic. Other values, the field can contain are not necessary.
I know that sounds easy but... I can't get it.
So, for Oracle 10 g 2... Here's my query:
SELECT a.person_id, a.person_status, a.message_id, a.order_id
OF t_HR one
WHERE a.person_status = "rejected".
AND a.id >
(SELECT max (b.id)
OF t_HR b
WHERE b.person_id = a.person_id
and b.order_id = a.order_id
AND b.person_status! "revised =".
B.ID AND < a.id)
ORDER BY desc a.id
Let me explain:
1 - HR table is a table of people. These people has serveral STATUS.
2 - ID is a sequential (each www.voyages-sncf.com has a different identification number).
3 - the application must get THAT all people "rejected".
4. - However, (subquery) I need ONLY those that previous register (the second register) holds a status of "OK". If the person holds a "revised" status he's not, he should be the next register (the third)
5.-L' ORDER ID DESC, so is the first register must have a STATUS = "rejected" and the second a 'OK '. IF the second register = "revised", then the third register must be 'OK '. And I need this query.
HOW DO?
My problem: the subquery gives you previous register of the same guy, but... it does not give you the value of the State, I need, which is 'OK '.
I tried to add to the subquery...
SELECT max (b.id)
OF mod_human_resource b
WHERE b.person_id = a.person_id
and b.order_id = a.order_id
AND b.person_status = 'OK '.
AND b.id < a.id
... but if I have 5 records of that person, the first is "rejected", the second is "accepted", the third is 'new' and the fourth is 'OK'... the subquery gives you the 4th register and which is not correct for me, it must be only the second one (prior to the first State registry).
I need to be a query, because I need to use it on a MERGER for a DWH.
If there is another way (function, or even a procedure) to make the MERGER rather than with a request, which would be ok too. I am poor DWH knowledge.
Thanks in advance.
Hello
So, you need to know if a line is the 'first' line, and you should also know what is the 'next' status, (even the 'first' and 'next' are already defined). This sounds like a job for analytical functions. ROW_NUMBER can tell you if a line is first or not, and LEAD can tell you what a value on the next row.
Since you post CREATE TABLE and INSERT statements for your own table, I'll use the table scott.emp to illustrate.
Consider these data from scott.emp:
SELECT DeptNo
ename
work
FROM scott.emp
ORDER BY deptno
ename DESC
;
Output:
DEPTNO ENAME JOB
---------- ---------- ---------
10 MILLER CLERK
PRESIDENT OF KING 10
MANAGER 10 CLARK
20 SMITH CLERK
ANALYST SCOTT 20
20 JONES MANAGER
20 FORD ANALYST
20 ADAMS CLERK
30 WARD SALESMAN
SELLER OF 30 TURNER
30 MARTIN SALESMAN
30 JAMES CLERK
MANAGER BLAKE 30
30 ALLEN SALESMAN
Now, let's say we want only who know the departments where the forefront (in order descending ename) a job = 'CLERK', and the following line (also in descending by ename order) = "ANALYST" job, and we want to know the ename of the first row. In other words, the correct output is:
DEPTNO ENAME
---------- ----------
20 SMITH
Note that deptno = 10 is not included, even if the first task is to "CLERK." that was because the second job in deptno = 10 is the "PRESIDENT", not "ANALYST."
Here's a way to get these results:
WITH got_analytics AS
(
SELECT ename, deptno, job
ROW_NUMBER () OVER (PARTITION BY deptno
ORDER BY ename DESC
) AS r_num
LEAD (employment) OVER (PARTITION BY deptno
ORDER BY ename DESC
) AS next_job
FROM scott.emp
)
SELECT deptno, ename
OF got_analytics
WHERE r_num = 1
AND job = 'CLERK '.
AND next_job = 'ANALYST '.
;
I hope that answers your question.
If this isn't the case, then, as Dan (and the FAQ forum) said, post CREATE TABLE and INSERT statements for some sample data and the exact results you want from these data.
Post your query, based on the one I have posted more top and ponit out where he gets results.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum: https://forums.oracle.com/message/9362002#9362002
-
How to run a query to update on the results to a spreadsheet
Hey there,
I'm new to this kinda thing.
I received a spreadsheet that has 2 tablets, 1 is called SQL generates and has a ton of data. 1 is called SQL statement and a select statement in the first cell.
I said to run an update query by using the worksheet and received this:
= CONCATENATE("Update CARDMEMBERISSUE set CURRSTATUSCD = 'ACT', DATELASTMAINT = sysdate where AGREENBR =",A2,"and MEMBERNBR =",B2,"and ISSUENBR =",C2,";")
= CONCATENATE("Insert into CARDMEMBERISSUEHIST (AGREENBR, MEMBERNBR, ISSUENBR, EFFDATETIME, CARDSTATCD, STATREASON, DATELASTMAINT, DATESENT) values (', A2, ',', B2, ',', C2", sysdate, 'Law', null, sysdate, null);' ")
I don't know what to do or how to do this.
It's that the lines in the worksheet as look, including the column header, A1 is empty.
A B C etc.
NBR MEMBERNBR QUESTION NBR CURRSTATUSCD PREFIX CARD NBR AGREETYPCD NBR EXT CARD ISSUE DATE PERS OWNER AGREE
2 12 1 44 ISS g 22 22 19/10/2011= CONCATENATE bits are Excel formulas. Assuming that they properly drafted, they generate a set of individual sql statements. The first concaenatewill generates a set of instructions to update on the CardMemberIssue table, and the second will generate a set of insert statement in the CardMemberIssueHist table.
You should be able to simply paste the instructions generated in any tool that you use to run sql to run. Before you do this right, make sure that you are running:
alter session set cursor_sharing=force;
before sticking anything in.
John
-
I can not find how to run this program on my HP50g Bessel functions...
Hello!
Recently, I buy my HP50g calculator and tried to find and install programs that I need... Solvesys is running, but I can't find how to operate this Bessel function program. I installed it exactly as solvesys (load the lib archive on the calculator and chargue on flash), but I can't find how to run commands, or when they are to crush with. I tried to access the list of orders directly through flash (press the arrow to the right while on archive of lib, then select from the list an eval push) but I get only a result bad argument...
Can someone guive me a helping hand?
The link for the program is
http://www.HPCalc.org/details.php?id=3140
Thanks in advance for your help
Hi!, Ahkran:
Happy new year and welcome to the Forum!
(1) you need to download the library library 764, BESSEL V1.2, HP50G, in the HOME directory.
Now, you need to install and stay permanently in memory, in any port (0, 1 or 2). Best if the option port 2 (Flash)...
Now, reset the HP50G, with YOU and key F3 (C)...
Find the library in Port 2, with orange right shift key and key LIB (2), with name BESSE. If necessary, use the NXT (L) key...
Now press the function key (F1... F6), just below the word BESSE, in your HP50G.
You have to see...
and with NXT - key...
Carefully read the instructions for use library 764, the .pdf file, the author.
-
How to run a script in environment unix and how to run this program into a toad
Hello guys
Please help me!
How to run a script in the unix environment (Group of programs (cursor, programs...) stored in a file file.sql).
file.sql luks like this
WHENEVER OSERROR EXIT FAILURE
WHENEVER SQLERROR EXIT SQL. SQLCODE
SET the position
SET serveroutput size 1000000
coil ins2aais_jobs;
SELECT "FILE IS: ins2aais_jobs' FROM dual;"
SELECT "STARTED:' began, to_char (sysdate," YY/MM/DD HH24:MI:SS) TIME FROM dual; "
DECLARE
lv_upd_ct number: = 0;
lv_ins_ct number: = 0;
lv_exp_ct number: = 0;
---------------------
date of lv_FROM_date;
date of lv_to_date;
lv_mon_or_week varchar2 (20);
date of lv_week_end_date;
lv_month_indicator varchar2 (8);
-------------------------------------------------
Aais CURSOR IS
SELECT the ID substr (ID, 1, 7), SSN, FNAME, LNAME
, SUCCESS, COMPENSATE, INSTALLATION
, MODU, DRIVE, REVERSE, SUCC_RATE
TRANS_TOTAL, FILE_NAME, WEEK_END_DATE
RUN_DATE
OF weekly_aais;
-------------------------
I aais % rowtype;
-------------------------
PROCEDURE p_ins (r1 aais % ROWTYPE) IS
BEGIN
BEGIN
INSERT INTO AAIS_JOBS
(ID, SSN, SUCCESS, COMPENSATE, INSTALL, MODU
, DRIVE, REVERSE, SUCC_RATE, TRANS_TOTAL
FILE_NAME, WEEK_END_DATE, RUN_DATE
AAIS_FNAME, AAIS_LNAME
)
VALUES
(r1.ID, r1. SSN, r1. SUCCESS, r1. COMPENSATE, r1. INSTALLATION, r1. MODU
r1. DISK, r1. CONVERSELY, r1. SUCC_RATE, r1. TRANS_TOTAL
r1. File_name, r1. WEEK_END_DATE, r1. RUN_DATE
r1. FNAME, r1. LNAME
);
lv_ins_ct: = lv_ins_ct + 1;
EXCEPTION
WHILE OTHERS then
DBMS_OUTPUT. PUT_LINE ('ERROR IN THE INSERT STATEMENT');
DBMS_OUTPUT. Put_line (SQLERRM);
lv_exp_ct: = lv_exp_ct + 1;
END;
END;
------------------------------
PROCEDURE p_disp_msg IS
BEGIN
DBMS_OUTPUT. Put_line (' number of insertion: ' | to_char (lv_ins_ct));
DBMS_OUTPUT. Put_line (' number of Exceptions: ' | to_char (lv_exp_ct));
lv_ins_ct: = 0;
lv_exp_ct: = 0;
END;
---------------------------
BEGIN
lv_FROM_date: = to_date ('& 1', 'DD-MON-RR');
lv_to_date: = to_date ('& 2', 'DD-MON-RR');
lv_mon_or_week: = 'and 3';
lv_month_indicator: = di.get_month_ind (lv_mon_or_week, lv_FROM_date, lv_to_date);
------------------------------------
REMOVE FROM AAIS_JOBS
WHERE WEEK_END_DATE = lv_to_date;
-------------------------------------
COMMIT;
Aais OPEN;
LOOP
EXTRACT the aais IN i;
OUTPUT WHEN aais % NOTFOUND;
BEGIN
p_ins (i);
END;
END LOOP;
Aais CLOSE;
commit;
DBMS_OUTPUT. PUT_LINE ('INSERT INTO TABLE JOBS AAIS');
p_disp_msg;
-----------------------------------
END;
/
SELECT "FINISHED: ' | '. TO_CHAR (sysdate, "MM/DD/YY HH24:MI:SS'") FROM dual
/
spool off
"exit";
and also how we organize this into a toad?
Thank you.Hello
You vous connecter connect to oracle through unix and SQL prompt, run these commands in a .sql file.
Toad, you can run the instructions individually by selecting the sql statements or in a set with the F5 key.
Kind regards
AJR -
some of you that it won't be easy, but for a rookie plsql is not form. Can U help?
want to find out who has max (salary) and record that information in a variable
Table: used
Select max (salary) in employee == > back 2500id salary 1 2000 2 2500 3 1800
But how to write this in a plsql and find the id is 3 and save it in a variable
my incomplete statement:
Select max (salary), in myvar to employee where id =?
can you help me?Oh and save it in a variable plsql:
declare my_var emp.empno%TYPE; begin select e1.empno into my_var from emp e1 where e1.sal = (select max(e2.sal) from emp e2) and rownum = 1; end; /
-
How to simplify this query in sql simple select stmt
Hello
Please simplify the query
I want to convert this query in a single select statement. Is this possible?
If uarserq_choice_ind is not null then
Select ubbwbst_cust_code
From ubbwbst,utrchoi
Where utrchoi_prop_code=ubbwbst_cancel_prod
Else
Select max(utvsrvc_ranking)
From utvsrvc,ubbwbst
Where utvsrvc_code=ubbwbst_cancel_prod
End ifSelect ubbwbst_cust_code as val From ubbwbst,utrchoi Where utrchoi_prop_code=ubbwbst_cancel_prod AND uarserq_choice_ind is not null union all Select max(utvsrvc_ranking) as val From utvsrvc,ubbwbst Where utvsrvc_code=ubbwbst_cancel_prod and uarserq_choice_ind is null
Without more information, we are unable to combine the two queries in 1 without a union.
Looks like you select values totally disperate of totally different tables -
How to solve this query in database using sqlite phone gap
am facing a problem in recent days. The problem is database. In fact, I create the mane database 'casepad '. Then I created a table because the database 'table of cases' have (ID, name, date). Now I insert the value on this table. When inserting I also create a name ("casename") .mean table if I insert the value of the case table (1, 'AB', 2/13). Then I create table AB. Now I need to get the value of the case table (I am) but I need to count the number of items in another table (AB). Here, I had to try it.
function onDeviceReady() { db = window.openDatabase("Casepad", "1.0", "Casepad", 200000); db.transaction(getallTableData, errorCB); } function insertData() { db.transaction(createTable, errorCB, afterSuccessTableCreation); } //createtableandinsertsome record function createTable(tx) { tx.executeSql('CREATE TABLE IF NOT EXISTS CaseTable (id INTEGER PRIMARY KEY AUTOINCREMENT, CaseName TEXT unique NOT NULL ,CaseDate INTEGER ,TextArea TEXT NOT NULL)'); tx.executeSql('INSERT OR IGNORE INTO CaseTable(CaseName,CaseDate,TextArea) VALUES ("' + $('.caseName_h').val() + '", "' + $('.caseDate_h').val() + '","' + $('.caseTextArea_h').val() + '")'); } //function will be called when an error occurred function errorCB(err) { navigator.notification.alert("Error processing SQL: " + err.code); } //function will be called when process succeed function afterSuccessTableCreation() { console.log("success!"); db.transaction(getallTableData, errorCB); } //select all from SoccerPlayer function getallTableData(tx) { tx.executeSql('SELECT * FROM CaseTable', [], querySuccess, errorCB); } function querySuccess(tx, result) { var len = result.rows.length; var t; $('#folderData').empty(); for (var i = 0; i < len; i++) { $('#folderData').append( '
- ' + '' + '' + '
' + result.rows.item(i).CaseName + t+'
' + '' + result.rows.item(i).TextArea + '
' + '' + result.rows.item(i).CaseDate + '
' + '' + i + '' + ''+' '
);
}
$('#folderData').listview('refresh');
}
-
Why can't I run this query in parallel?
DB version: 11.2.0.4
Platform: Oracle Linux 6.5
In my DB, a job with parallelism 5 as stats collection below works well. OEM, I confirm that the bottom congregate, stats job runs with 5 slave process.
exec dbms_stats.gather_table_stats (-)
ownname = > 'MEA ', -.
tabname = > "ORDER_DETAIL", -.
estimate_percent = > DBMS_STATS. AUTO_SAMPLE_SIZE, -.
Cascade = > TRUE;
method_opt = > 'for all THE COLUMNS of SIZE AUTO ', -.
degree = > 5);
Order_Detail is a table with 400 million records. I wanted to get a number of rows in this table. So, I tried to use parallelism as shown below.
But the process of slaves were not created. The SELECT query worked only with parallelism 1. I have this cofirmed of data in real-time to OEM and gv$ view px_session.
SQL > show parameter parallel_max_servers
VALUE OF TYPE NAME
------------------------------------ ----------- ------------------------------
PARALLEL_MAX_SERVERS around 3200
SQL > ALTER SESSION FORCE PARALLEL QUERY 5 PARALLELS;
Modified session.
SQL > ALTER SESSION enable parallel query.
Modified session.
SQL > select / * + PARALLEL (5) * / count (*) from ptms.order_detail;
-Also tried
Select / * + PARALLEL(ptms.order_detail,5) * / count (*) from ptms.order_detail;
-Also tried
ALTER SESSION ENABLE PARALLEL DML.
-Setting below must not be the cause. Right? ALTER SESSION command must take precedence over this setting. Right?
SQL > select table_name, DEGREE from dba_tables where owner = 'MEA' and table_name = "ORDER_DETAIL";
DEGREE OF TABLE_NAME
------------------------------ ----------------------------------------
ORDER_DETAIL 1
Have you tried the trick
SELECT / * + PARALLEL * / COUNT (*)...
-
I'm looking for only column compare to my same target table as a table source.
My query:
Select case when column_name_s is null and column_name_t is not null
then "alter table GRADE_CONVERSION drop | column_name_t | ';'
When column_name_s is not null and column_name_t is null
then "alter table GRADE_CONVERSION add | column_name_s | ' ' || data_type_s | « ; »
else 'alter table modify GRADE_CONVERSION | column_name_t | ' ' || data_type_t | « ; »
alterations of the end
from (select s.column_name column_name_s, t.column_name column_name_t,
s.data_type data_type_s, t.data_type data_type_t
(select column_name, column_id, data_type
of all_tab_cols@database
where owner = 'erhan.
and table_name = "GRADE_CONVERSION."
+ 1
full outer join
(select column_name, column_id, data_type
of all_tab_cols@database
where owner = 'sarigul.
and table_name = "GRADE_CONVERSION."
+ 6
on s.column_name = t.column_name
)
Tables:
Target table: table GRADE_CONVERSION in sarigul@database
LETTER_GRADE VARCHAR2 (2) GRADE_POINT NUMBER (3.2) MAX_GRADE NUMBER (3) MIN_GRADE NUMBER (3) Table source: Table GRADE_CONVERSION in erhan@database
LETTER_GRADE VARCHAR2 (2) GRADE_POINT NUMBER (3.2) MAX_GRADE NUMBER (3) MIN_GRADE NUMBER (3) CREATED_BY VARCHAR2 (30) CREATED_DATE DATE MODIFIED_BY VARCHAR2 (30) MODIFIED_DATE DATE want to see output that is similar to this * (please ignore the names of column here it's just a clear example :))
ALTER table Target_table change BOOK_ID Varchar2 (4);
ALTER table Target_table I addSBN_10 Varchar2(13), null;
ALTER table drop TITLE Target_table;
Erhan_toronto wrote:
1.I used src.nullable src_nullable and tgt.nullable tgt_nullable but only show Yes as below: but want to see the result as not null or null
ALTER table TEST_TARGET change the NUMBER of MAX_GRADE (3, 2) Yes
Ok. So it's all about the Yes and the no decoding to Default Null or Not Null, isn't it?
So, to test, change one of the table of sample for NOT NULL columns in the source table, and then run the following query:
with src as ( select src.table_name src_table_name, src.column_name src_col_name, src.data_type src_data_type, src.data_length src_data_len, src.data_precision src_data_precision, src.data_scale src_data_scale, src.nullable src_nullable from user_tab_columns src where table_name = 'TEST_SOURCE' ), tgt as ( select tgt.table_name tgt_table_name, tgt.column_name tgt_col_name, tgt.data_type tgt_data_type, tgt.data_length tgt_data_len, tgt.data_precision tgt_data_precision, tgt.data_scale tgt_data_scale, tgt.nullable tgt_nullable from user_tab_columns tgt where table_name = 'TEST_TARGET' ), col_details as ( select src.src_table_name, nvl(tgt.tgt_table_name, first_value(tgt_table_name) over(order by tgt_table_name nulls last)) tgt_table_name, src.src_col_name, src.src_data_type, src.src_data_len, src.src_data_precision, src.src_data_scale, src.src_nullable, tgt.tgt_col_name, tgt.tgt_data_type, tgt.tgt_data_len, tgt.tgt_data_precision, tgt.tgt_data_scale, tgt.tgt_nullable from src left outer join tgt on ( src.src_col_name = tgt.tgt_col_name ) ) select * from ( select case when tgt_data_type != src_data_type or tgt_data_len != src_data_len or tgt_data_precision != src_data_precision or tgt_data_scale != src_data_scale or src_nullable != tgt_nullable then 'alter table ' || tgt_table_name || ' modify ' || tgt_col_name || ' ' || src_data_type || ' (' || case when src_data_type in ('DATE') then null else case when src_data_type in ('VARCHAR', 'VARCHAR2') then nvl(to_char(src_data_len), ' ') || ') ' else decode(nvl(src_data_precision, -1), -1, null, nvl(to_char(src_data_precision), ' ') || ', ' || nvl(to_char(src_data_scale), ' ') || ')') end end || decode(src_nullable, 'NO', ' NOT NULL', ' DEFAULT NULL') when tgt_col_name is null then 'alter table ' || tgt_table_name || ' add ' || src_col_name || ' ' || src_data_type || case when src_data_type in ('DATE') then null else case when src_data_type in ('VARCHAR', 'VARCHAR2') then nvl(to_char(src_data_len), ' ') || ') ' else decode(nvl(src_data_precision, -1), -1, null, nvl(to_char(src_data_precision), ' ') || ', ' || nvl(to_char(src_data_scale), ' ') || ')') end end || decode(src_nullable, 'NO', ' NOT NULL', ' DEFAULT NULL') end alter_statement from col_details ) where alter_statement is not null;
Erhan_toronto wrote:
2. when I run below under user sarigul and erhan I get the result as OWNER, TABLE_NAME, COLUMN_NAME DATA_TYPE... I have a link between two users. They have access to two tables.
- Select * from all_tab_columns
where owner = 'erhan' and table_name = "TEST_SOURCE."
- Select * from all_tab_columns
where owner = 'sarigul' and table_name = "TEST_TARGET."
Alright. This means that you both users are on the same database. Only change, you will have to do in the above query is so change user_tab_columns to all_tab_columns and add the OWNER predicate respectively with the clause.
Instend of show the value of 'i' in the view list, I need to show how many element in the table. I have to call synchronize because I call a query that counts the number of elements to 'result.rows.item (i). CaseName"this item... ?
Hello
If I understand correctly, you are looking for a SQL statement that you will get the count for the number of items in the table AB? If so, this can be useful:
http://www.w3schools.com/SQL/sql_func_count.asp
Please let me know if you have any other questions.
Maybe you are looking for
-
Two questions with Satellite A210-1ap
Hi, I'm from Turkey. My English isn't good. I think I can explain my problem. I have Windows XP Home edition system. I have implemented all the drivers of Windows XP Home edition for my laptop. But I can t set up Power Saver' and ' Modules common "(e
-
I'm working on one of these AM2 Athlon 64 X 2 4800 + (Windows Vista Home Premium with Windows MediaCritters Center (32 bit)) to a customer (slowdowns, BSOD, boots, hangs / freezes). After doing thorough hardware tests (PSU, CPU, RAM and HARD drive ar
-
Color LaserJet: What does HPInstallLogCollector.exe do?
No one knows what to do these files? And why they are in the temp folder? HP - DQEX5.exe hpUrlLauncher.exe HPInstallLogCollector.exe Thank you Mike
-
Error message that I need help... Director Player error
Heya all I have a problem n need a fix as soon as possible.I have to put in some work of course via the web n one discwhenever I'm going to submit my work I was informed via pop-up "Director Player error."Script errorContinue?Yes or no Please I reall
-
Microsoft Media Center remote with pace DC50X 1039, Setup box cannot change channel
Can I use Vista Media Center to record only TV etc...Recently I had to use a configuration of Comcast Digital adapter carrier (DC50X) in order to get access to the channels. Vista recognize the Remote Setup Box, but it is not able to change the chann