TYPE table in duplicate
I have a procedure I use to build a dynamic HTML region in the APEX. For some reason, I'm getting an extra value in the TYPE table that isn't there in the query. I wonder if someone can point out the default:create or replace PROCEDURE PROC_REC_MIXED(x_org NUMBER, x_dt DATE)
AS
v_dt DATE := x_dt;
v_org_id NUMBER := x_org;
TYPE tab_pyld is TABLE of VARCHAR(8) INDEX BY BINARY_INTEGER;
pylds tab_pyld;
cursor c_pyld is select DISTINCT(t.PAYLOAD_TYPE_ID), t.PAYLOAD_TYPE_ABBR
from OTHR_RATES r, PAYLOAD_TYPE t
where r.PAYLOAD_TYPE_ID = t.PAYLOAD_TYPE_ID
and r.LOCATION_ID = v_org_id and r.PAYLOAD_TYPE_ID IS NOT NULL;
pyld_id INTEGER;
pyld_typ VARCHAR2(8);
j INTEGER := 1;
prod1_id INTEGER;
prod1_nm VARCHAR2(8);
prod2_id INTEGER;
prod2_nm VARCHAR2(8);
prod3_id INTEGER;
prod3_nm VARCHAR2(8);
prod4_id INTEGER;
prod4_nm VARCHAR2(8);
prod5_id INTEGER;
prod5_nm VARCHAR2(8);
prod6_id INTEGER;
prod6_nm VARCHAR2(8);
prod7_id INTEGER;
prod7_nm VARCHAR2(8);
prod8_id INTEGER;
prod8_nm VARCHAR2(8);
prod9_id INTEGER;
prod9_nm VARCHAR2(8);
prod10_id INTEGER;
prod10_nm VARCHAR2(8);
-----------------------------
ttl_log_hrs NUMBER := 0;
ttl_std_hrs NUMBER := 0;
s_bill_hrs NUMBER := 0;
d_bill_hrs NUMBER := 0;
s_nobill_hrs NUMBER := 0;
d_nobill_hrs NUMBER := 0;
ttl_s_bill_hrs NUMBER := 0;
ttl_d_bill_hrs NUMBER := 0;
ttl_s_nobill_hrs NUMBER := 0;
ttl_d_nobill_hrs NUMBER := 0;
-----------------------------
s1_b_lds NUMBER := 0;
d1_b_lds NUMBER := 0;
s1_nb_lds NUMBER := 0;
d1_nb_lds NUMBER := 0;
s1_b_tns NUMBER := 0;
d1_b_tns NUMBER := 0;
s1_nb_tns NUMBER := 0;
d1_nb_tns NUMBER := 0;
prod1_sttllds NUMBER := 0;
prod1_sttltns NUMBER := 0;
prod1_dttllds NUMBER := 0;
prod1_dttltns NUMBER := 0;
begin
htp.p('<table cellpadding="0" cellspacing="0" summary="Daily Reconciliation - Hourly Work">');
htp.p('<tr><th rowspan="2" width="60"> </th><th rowspan="2" width="60"> </th>');
htp.p('<th colspan="3" rowspan="2" class="cl" width="240">Driver Time</th>');
htp.p('<th colspan="5" class="cl" width="220">Hours</th>');
open c_pyld;
LOOP
EXIT WHEN c_pyld%NOTFOUND;
FETCH c_pyld INTO pyld_id, pyld_typ;
--htp.p('<th colspan="'||prod_ct*2||'" class="cl">Loads</th>');
htp.p('<th colspan="4" class="cl">Loads</th>');
--htp.p('<th colspan="'||prod_ct*2||'" class="cl">Tons</th></tr>');
htp.p('<th colspan="4" class="cl">Tons</th>');
END LOOP;
close c_pyld;
htp.p('</tr>');
htp.p('<tr><th class="cl" rowspan="2" width="60">Standby</th>');
htp.p('<th colspan="2" class="c" width="80">Billable</th>');
htp.p('<th colspan="2" class="c" width="80">Non-Billable</th>');
open c_pyld;
LOOP
EXIT WHEN c_pyld%NOTFOUND;
FETCH c_pyld INTO pyld_id, pyld_typ;
---------LOADS
htp.p('<th colspan="2" class="rl" width="80">Billable<br />'||pyld_typ||' '||pyld_id||'</th>');
htp.p('<th colspan="2" class="rl" width="80">Non-Billable<br />'||pyld_typ||' '||pyld_id||'</th>');
---------TONS
htp.p('<th colspan="2" class="rl" width="80">Billable<br />'||pyld_typ||' '||pyld_id||'</th>');
htp.p('<th colspan="2" class="rl" width="80">Non-Billable<br />'||pyld_typ||' '||pyld_id||'</th>');
END LOOP;
close c_pyld;
htp.p('</tr>');
htp.p('<tr><th class="r">Emp #</th><th class="c">Unit #</th>');
htp.p('<th class="cl">Start Time</th><th class="c">End Time</th><th class="c">Logged Hrs</th>');
htp.p('<th class="c">S</th><th class="c">D</th>');
htp.p('<th class="c">S</th><th class="c">D</th>');
---------LOADS
htp.p('<th class="rl">S</th><th>D</th>');
htp.p('<th class="rl">S</th><th>D</th>');
---------TONS
htp.p('<th class="rl">S</th><th>D</th>');
htp.p('<th class="rl">S</th><th>D</th>');
htp.p('</tr>');
FOR t in (SELECT rh.TC_ID tc, rh.EMP_ID em, rh.EQUIP_ID eq,
to_char(rh.START_TIME,'HH:MI AM') s,
to_char(rh.END_TIME,'HH:MI AM') e, rh.LOG_HRS h,
NVL(SUM(rs.STANDBY_HRS),0) b
from V_RECONCILE_HRS rh, V_RECONCILE_STANDBY rs
where rh.TC_ID = rs.TC_ID (+)
and rh.ORG_ID = v_org_id and rh.DATE_INDEX = v_dt
group by rh.TC_ID, rh.EMP_ID, rh.EQUIP_ID,
rh.START_TIME, rh.END_TIME, rh.LOG_HRS) LOOP
htp.p('<tr><td class="c">' ||t.em||'</td><td class="c">'||t.eq||'</td>');
htp.p('<td class="cl">'||t.s|| '</td><td class="c">'||t.e|| '</td>');
htp.p('<td class="r">' ||t.h||' </td>');
htp.p('<td class="rl">'||t.b||' </td>');
select NVL(SUM(j.BILL_HRS),0) into s_bill_hrs
from TC c, TC_OTHR_JOBS j
where c.TC_ID = j.TC_ID
and j.SPECIAL = 'S' and c.TC_ID = t.tc;
select NVL(SUM(j.BILL_HRS),0) into d_bill_hrs
from TC c, TC_OTHR_JOBS j
where c.TC_ID = j.TC_ID
and j.SPECIAL IS NULL and c.TC_ID = t.tc;
htp.p('<td class="r">'||s_bill_hrs||' </td>');
htp.p('<td class="r">'||d_bill_hrs||' </td>');
htp.p('<td class="r">'||s_nobill_hrs||' </td>');
htp.p('<td class="r">'||d_nobill_hrs||' </td>');
ttl_log_hrs := ttl_log_hrs + t.h;
ttl_std_hrs := ttl_std_hrs + t.b;
ttl_s_bill_hrs := ttl_s_bill_hrs + s_bill_hrs;
ttl_d_bill_hrs := ttl_d_bill_hrs + d_bill_hrs;
ttl_s_nobill_hrs := ttl_s_nobill_hrs + s_nobill_hrs;
ttl_d_nobill_hrs := ttl_d_nobill_hrs + d_nobill_hrs;
s1_b_lds := 0;
s1_b_tns := 0;
prod1_sttllds := prod1_sttllds + s1_b_lds;
prod1_sttltns := prod1_sttltns + s1_b_tns;
--------------------------------------
d1_b_lds := 0;
d1_b_tns := 0;
prod1_dttllds := prod1_dttllds + d1_b_lds;
prod1_dttltns := prod1_dttltns + d1_b_tns;
---------LOADS
htp.p('<td class="rl">'||s1_b_lds ||' </td>');
htp.p('<td class="r">' ||d1_b_lds ||' </td>');
htp.p('<td class="rl">'||s1_nb_lds||' </td>');
htp.p('<td class="r">' ||d1_nb_lds||' </td>');
---------TONS
htp.p('<td class="rl">'||s1_b_tns ||' </td>');
htp.p('<td class="r">' ||s1_nb_tns||' </td>');
htp.p('<td class="rl">'||d1_b_tns ||' </td>');
htp.p('<td class="r"> '||d1_nb_tns||' </td>');
htp.p('</tr>');
END LOOP;
-----------------------------
htp.p('<tr><td class="cu"> </td><td class="cu"> </td>');
htp.p('<td class="cul"> </td><td class="cu"> </td>');
htp.p('<td class="ru">' ||ttl_log_hrs||' </td>');
htp.p('<td class="rul">'||ttl_std_hrs||' </td>');
htp.p('<td class="ru">' ||ttl_s_bill_hrs||' </td>');
htp.p('<td class="ru">' ||ttl_d_bill_hrs||' </td>');
htp.p('<td class="ru">' ||ttl_s_nobill_hrs||' </td>');
htp.p('<td class="ru">' ||ttl_d_nobill_hrs||' </td>');
---------LOADS
htp.p('<td class="rul">'||prod1_sttllds||' </td>');
htp.p('<td class="ru">' ||prod1_dttllds||' </td>');
htp.p('<td class="rul">'||prod1_sttllds||' </td>');
htp.p('<td class="ru">' ||prod1_dttllds||' </td>');
---------TONS
htp.p('<td class="rul">'||prod1_sttltns||' </td>');
htp.p('<td class="ru">' ||prod1_dttltns||' </td>');
htp.p('<td class="rul">'||prod1_sttltns||' </td>');
htp.p('<td class="ru">' ||prod1_dttltns||' </td>');
htp.p('</tr>');
htp.p('</table>');
end;
/
I am trying to build a business report. The report should break down the activity by type of product by the project, but there could be a number of different products. In this case, there are only two products. The query:select DISTINCT(t.PAYLOAD_TYPE_ID), t.PAYLOAD_TYPE_ABBR
from OTHR_RATES r, PAYLOAD_TYPE t
where r.PAYLOAD_TYPE_ID = t.PAYLOAD_TYPE_ID
and r.LOCATION_ID = 584 and r.PAYLOAD_TYPE_ID IS NOT NULL;
gives only two lines: Gravel (#5) and Pavement (#18). Still in the output, roadway appears twice. I don't know there is something that I'm on. Your help is greatly appreciated.
Take the exit after a recovery. (in the two loops)
You have,
EXIT WHEN c_pyld%NOTFOUND;
FETCH c_pyld INTO pyld_id, pyld_typ;
To take
FETCH c_pyld INTO pyld_id, pyld_typ;
EXIT WHEN c_pyld%NOTFOUND;
G.
Tags: Database
Similar Questions
-
the server script, line 2610; 2 the argument must be of type table
I get an error message: script server, line 2610; 2 the argument must be of type table.
This message appears on the screen immediately after that I turned on my laptop. Please see the below.
Please advise the possible fix for this problem.
Thank you
To resolve your concern, we suggest that you perform a clean boot on your computer. Perform a clean boot on your computer will help us eliminate software conflicts that could cause this error message. To perform a clean boot on your computer, follow the steps on this link.
Let us know how it goes.
-
Value data named to bind variables of Type table
Hello
I have a display object with a query that has a where clause, clause which use 'en' (e.g. Select projTitle PROJECT where PROJID in: projIds)
'projIds' is a variable of type table of liaison.
I'm moving in that variable binding expects (an array of projIds that can be used by the sql statement), and I did not. I'm calling a method in the bean to support the named child tag data from the action tag in the pageDef file links section.
Can you give me the proper syntax and object Array as this variable binding will accept, please? Maybe I used the wrong NDType? I found a couple of different options, but none that I can make it work.
The page definition file:
< action IterBinding = "ProjPendingApprovalByApproverVO1Iterator" id = "loadPendingApproval".
InstanceName = "SystemAMDataControl.RooProjIdArrayt.ApprovalAM1.ProjPendingApprovalByApproverVO1"
DataControl = "SystemAMDataControl" RequiresUpdateModel = "true" Action = "executeWithParams" >
< NamedData NDName = 'PROJID"NDValue =" #{dashboard.projIdArray} "NDType="oracle.jbo.domain.Array"/ >"
< / action >
Application of VO:
SELECT ProjectEO.PROJ_ID,
ProjUtnDtlEO.UTN_TYPE,
ProjectEO.PROJ_SHORT_DESC,
ProjUtnDtlEO.PROJ_DTL_ID,
ProjectEO.PROJ_OWNER,
VEmployeeInfoEO.FIRST_NAME,
VEmployeeInfoEO.EMPLOYEE_ID,
VEmployeeInfoEO.FIRSTNAMELASTNAME,
VEmployeeInfoEO.LAST_NAME,
VEmployeeInfoEO.LASTNAMEFIRSTNAME,
ProjApprovalDecisionDtlEO.PROJ_APPROVAL_DECISION_DTL_ID,
ProjApproverEO.PROJ_APPROVER_ID,
ProjApproverEO.APPROVER_LEVEL,
ProjApproverEO.APPROVER_NUMBER,
ProjApproverEO.APPROVER_ROLE,
ProjApprovalDecisionDtlEO.COMMENTS,
ProjApprovalDecisionDtlEO.PROJ_APPROVAL_DECISION_ID,
ProjApprovalDecisionDtlEO.LASTUPDATEDBY,
ProjApprovalDecisionDtlEO.APPROVEDDATE,
ProjectEO.SYS_STATUS,
ProjApproverEO.LASTUPDATEDBY AS LASTUPDATEDBY1,
ProjApprovalDecisionDtlEO.PROJ_APPROVAL_TYPE_ID,
ProjStatusLkpEO.STATUS_DESC,
ProjStatusLkpEO.PROJ_STATUS_ID,
ProjectEO.PROJ_CATEGORY_ID,
STRING. APPROVAL_DESC
OF PTS. ProjectEO PROJECT,
PTS. PROJ_UTN_DTL ProjUtnDtlEO,
PTS. V_EMPLOYEE_INFO VEmployeeInfoEO,
PTS. PROJ_APPROVAL_DECISION_DTL ProjApprovalDecisionDtlEO,
PTS. PROJ_APPROVER ProjApproverEO,
PTS. PROJ_STATUS_LKP ProjStatusLkpEO,
PTS. Channel PROJ_APPROVAL_CHAIN_LKP
WHERE ((ProjectEO.PROJ_ID = ProjUtnDtlEO.PROJ_ID (+))
AND (ProjectEO.PROJ_ID = ProjApprovalDecisionDtlEO.PROJ_ID))
AND (ProjectEO.PROJ_ID = ProjApproverEO.PROJ_ID)
AND (ProjectEO.SYS_STATUS = ProjStatusLkpEO.SYS_STATUS)
AND (ProjectEO.PROJ_OWNER = VEmployeeInfoEO.EMPLOYEE_ID)
AND (ProjApprovalDecisionDtlEO.PROJ_APPROVER_ID = ProjApproverEO.PROJ_APPROVER_ID)
and PROJAPPROVEREO. PROJ_APPROVAL_CHAIN_ID = STRING. PROJ_APPROVAL_CHAIN_ID
AND (ProjApprovalDecisionDtlEO.PROJ_APPROVAL_DECISION_ID = 0)
and PROJAPPROVEREO. APPROVER_LEVEL <>2
and PROJAPPROVEREO. PROJ_ID in: PROJID
Thank you!
Please refer to http://www.jobinesh.com/2010/09/using-bind-variable-for-sql-statements.html?m=1 for an example of this.
Timo
-
Insert values into a table from another table without duplicates
Hello
I have a table with a field called ID; This field has duplicate values of ID.
Then I have an empty table B (with the same fields of the table A) and I want to insert the values of the ID (on the table) without duplicates.
Can you help me?
Thank you much in advance.Hello
If your table has duplicate values, then you cannot add a UNIQUE constraint. In this case, you will need to use a roundabout way or remove duplicates before imposing the constraint. Hope it answers your question.
see you soon
VT
-
a table are in the other table without duplicate
How to check the records in a table are in the other table without duplicate.
for example, in the tables below, the records from the Table A are in Table B1. But the B2 table has duplicate and one record is missing.
I want to know which records are not in table B, records that have two copies.
as A and B2, 1 2 is not in B2, 1 1 a 2 folders in B2
A and B1, nothing should be returned.
Table A
-----------
A1 A2
-----------
1 1
1 2
1 3
-----------
Table B1
-----------
A1 A2
-----------
1 1
1 4
1 2
1 3
2 2
-----------
Table B2
-----------
A1 A2
-----------
1 1
1 4
1 3
2 3
1 1
-----------
version is the database of Oracle 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production
Thank you!!Two standard methods to compare the tables are either to use DEFINED such as UNION, UNION operations or LESS.
Or use a FULL OUTER JOIN.If the structure of the table is the same and that you want to compare all the columns, then set them operators are the best way.
If you want to compare only on one or more columns and want to see the other columns, then a FULL OUTER JOIN is the best way.
Here is an example
select A1, A2, count(distinct sourcetable) cnt_tables, count(sourcetable) cnt_records, count(case when sourcetable = 'A' then 1 end) record_is_in_A, count(case when sourcetable = 'B1' then 1 end) record_is_in_B1, count(case when sourcetable = 'B2' then 1 end) record_is_in_B2 (select 'A' sourceTable, a.* from tableA a union all select 'B1' sourceTable, b1.* from tableB1 b1 union all select 'B2' sourceTable, b2.* from tableB2 b2 ) group by A1, A2 having count(distinct sourcetable) < count(sourcetable) ;
It is an example. It will show you the records that have duplicate data in the following tables.
If you want to display all records that are in A but not in B1, you can add a few other checks.Published by: Sven w. on August 13, 2010 17:23
-
Reading of several objects of type table returned
Hi gurus,
I have a procedure that is called by a Java code.
There are 2 (type VARCHAR) input parameters and output parameters 3 viz TWO objects of type Table and a cursor type.
As out parameters are objects, not simple variables, I'm not able to test this procedure in Oracle SQL developer, please help me to do so.
Concerning
Villepreux
Published by: Villepreux on February 4, 2010 14:47Create an anonymous block like this and run.
declare OutParameter1
; OutParameter2 ; OutParameter3 ; begin procedure_name(InParameter1, InParameter2, OutParameter1, OutParameter2, OutParameter3); end; -
Table Row duplicates button click, but carries with it data
What I mean is, I have a form with a table on page 1. I created the floating fields on page two where the data entered in the the flow in text fields, which works very well. I added a button for the user to add rows to the table and the table row repeat.
However, when I type the data into the table and click on the button to add another line, it duplicates the line containing the data that I typed in. Of course, this isn't what I want to say are you seeking. I've never had this problem before. It's because of the floating fields. What I am doing wrong?
Hello
You can use two tables (one on the entry page) and the other on the page of the letter that are related. See an example here: http://assure.ly/eTOXaH.
Note that the script in the event of output from the fields in the table.
Hope that helps,
Niall
-
In Oracle Pipelined Table functions duplicate rows
Hi fellow oracle users,
I am trying to create a table function Oracle piplined that contains duplicate records. Whenever I try to run the same record twice, the duplicate does not appears in the resulting table in pipeline.
Here is a sample of SQL:
/ * Type declarations * /.
TYPE MY_RECORD IS (RECORD
MY_NUM INTEGER
);
IS OF TYPE THE MY_RECORD TABLE MY_TABLE;
/ * Pipelined function declaration * /.
FUNCTION MA_FONCTION MY_TABLE RETURN PIPELINE IS
V_RECORD MY_RECORD;
BEGIN
-Insert the first disc
V_RECORD. MY_NUM = 1;
COURSE OF ACTION (V_RECORD);
-Insert the second duplicate record
V_RECORD. MY_NUM = 1;
COURSE OF ACTION (V_RECORD);
-Return piplined table
RETURN;
END;
/ * Function in query pipeline declaration * /.
SELECT * FROM TABLE (MA_FONCTION); -for some reason any that returns only one record instead of two
I try to get the duplicate line appears in the select statement. Any help would be greatly appreciated.Can you provide real SQL output * more guest try this? I do not see the same behavior
SQL> SELECT * FROM V$VERSION; BANNER ---------------------------------------------------------------- Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi PL/SQL Release 10.2.0.4.0 - Production CORE 10.2.0.4.0 Production TNS for 64-bit Windows: Version 10.2.0.4.0 - Production NLSRTL Version 10.2.0.4.0 - Production SQL> CREATE TYPE MY_RECORD IS OBJECT(MY_NUM INTEGER); 2 / Type created. SQL> CREATE TYPE MY_TABLE IS TABLE OF MY_RECORD; 2 / Type created. SQL> CREATE OR REPLACE FUNCTION MY_FUNCTION 2 RETURN MY_TABLE 3 PIPELINED 4 AS 5 V_RECORD MY_RECORD; 6 BEGIN 7 V_RECORD.MY_NUM := 1; 8 PIPE ROW(V_RECORD); 9 10 V_RECORD.MY_NUM := 1; 11 PIPE ROW(V_RECORD); 12 13 RETURN; 14 END; 15 / Function created. SQL> SELECT * FROM TABLE(MY_FUNCTION); MY_NUM -------------------- 1 1
-
What is the easier, more realistic (programs type not duplicate file finder) to delete files 'duplicate '?
Moved from Internet Explorer (unknown/other)
Original title: NOT a Finder double file
Well a double-file-finder is the only realistic way.
If you don't want to use software to make life easier for you, you could do it the hard way: drag - move all files in the same folder. If both have the same name, the system will offer to combine by crushing with the other so alone is the surplus.
Of course, that counts only if the names are the same. If you don't want to use software to facilitate your work, there will be a lot of work.
-
Matching records between 2 tables with duplicate records
Hi all
I need help in what follows.
I have 2 tables Received_bills and Send_bills.
-------------------------------------------------------
-The DOF for Table SEND_BILLS
--------------------------------------------------------
CREATE TABLE SEND_BILLS
(DATE OF "DATUM",
NUMBER OF "PAYMENT."
'CODE' VARCHAR2 (5 BYTE)
) ;
--------------------------------------------------------
-The DOF for Table RECEIVED_BILLS
--------------------------------------------------------
CREATE TABLE 'RECEIVED_BILLS '.
(DATE OF "DATUM",
NUMBER OF "PAYMENT."
'CODE' VARCHAR2 (5 BYTE),
VARCHAR2 (5 BYTE) 'STATUS' ) ;
INSERTION of REM in RECEIVED_BILLS
TOGETHER TO DEFINE
Insert. RECEIVED_BILLS (DATUM, PAYMENT, CODE, STATE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'SUCCESS');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 'A5', 'SUCCESS', 25);
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 47, 'A4', 'FAILED');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'FAILED');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'SUCCESS');
INSERTION of REM in SEND_BILLS
TOGETHER TO DEFINE
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 47, 'A4');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('09-OCT-15','DD-MON-RR'), 19, 'A8');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 20, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');
I match all records of send_bills and received_bills with a status of 'SUCCESS' There is no single column in the table.
Correspondence held payment of columns, the code and the scratch cards, but it may also duplicate records. But even if there are duplicates, I also need those records in the query results
the query I wrote is this:
SELECT SEND.*
REC received_bills, send_bills send
WHERE send.datum = rec.datum
AND send.payment = rec.payment
AND send.code = rec.code
AND 'rec.status =' SUCCESS
;
The query results give me this
OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 The result of the correct application would be
OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 OCTOBER 10, 15 19 A1 The select statement that I need I want to use a loop to insert records in another table.
Can someone help me please?
Thanks in advance.
Best regards
Caroline
Hi, Caroline.
Caroline wrote:
Hi all
I need help in what follows.
I have 2 tables Received_bills and Send_bills.
-------------------------------------------------------
-The DOF for Table SEND_BILLS
--------------------------------------------------------
CREATE TABLE SEND_BILLS
(DATE OF "DATUM",
NUMBER OF "PAYMENT."
'CODE' VARCHAR2 (5 BYTE)
) ;
--------------------------------------------------------
-The DOF for Table RECEIVED_BILLS
--------------------------------------------------------
CREATE TABLE 'RECEIVED_BILLS '.
(DATE OF "DATUM",
NUMBER OF "PAYMENT."
'CODE' VARCHAR2 (5 BYTE),
VARCHAR2 (5 BYTE) 'STATUS');
INSERTION of REM in RECEIVED_BILLS
TOGETHER TO DEFINE
Insert. RECEIVED_BILLS (DATUM, PAYMENT, CODE, STATE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'SUCCESS');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 'A5', 'SUCCESS', 25);
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 47, 'A4', 'FAILED');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'FAILED');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'SUCCESS');
INSERTION of REM in SEND_BILLS
TOGETHER TO DEFINE
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 47, 'A4');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('09-OCT-15','DD-MON-RR'), 19, 'A8');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 20, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');
I match all records of send_bills and received_bills with a status of 'SUCCESS' There is no single column in the table.
Correspondence held payment of columns, the code and the scratch cards, but it may also duplicate records. But even if there are duplicates, I also need those records in the query results
the query I wrote is this:
SELECT SEND.*
REC received_bills, send_bills send
WHERE send.datum = rec.datum
AND send.payment = rec.payment
AND send.code = rec.code
AND 'rec.status =' SUCCESS
;
The query results give me this
OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 The result of the correct application would be
OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 OCTOBER 10, 15 19 A1 The select statement that I need I want to use a loop to insert records in another table.
Can someone help me please?
Thanks in advance.
Best regards
Caroline
Want to get answers that work? Then make sure that the CREATE TABLE and INSERT statements you post too much work. Test (and, if necessary, correct) your statements before committing. You have a stray "." in the first INSERT statement for received_bills and receikved_bills.status is defined as VARCHAR2 (5), but all values are 6 characters long.
There are 5 lines in send_bills that are similar to the
10 OCTOBER 2015 19 A1
Why do you want that 2 rows like this in the output, not 1 or 3, or 4 or 5? Is it because there are 2 matching rows in received_bills? If so, you can do something like this:
WITH rec AS
(
SELECT the reference, payment, code
, ROW_NUMBER () OVER (PARTITION BY datum, payment, code)
ORDER BY NULL
) AS r_num
OF received_bills
Situation WHERE = 'SUCCESS'
)
send AS
(
SELECT the reference, payment, code
, ROW_NUMBER () OVER (PARTITION BY datum, payment, code)
ORDER BY NULL
) AS r_num
OF send_bills
)
SELECT send.datum, send.payment, send.code
REC, send
WHERE send.datum = rec.datum
AND send.payment = rec.payment
AND send.code = rec.code
AND send.r_num = rec.r_num
;
Note that the main request is very similar to the query you posted, but the last condition has changed.
If you need to insert these lines in another table, you can use this query in an INSERT statement. There is no need of a loop, or for any PL/SQL.
-
How to call the procedure type table
Hi I have the below requirement
Created in the sub table type
CREATE or REPLACE the TYPE char_type IS the TABLE OF VARCHAR2 (4000);
create or replace procedure test_proc_type (p_type char_type) is
Start
I'm looping 1.p_type.count
dbms_output.put_line (p_type (i));
end loop;
end;
How to call the procedure with parameter as a type!
SQL> create or replace type char_type as table of varchar2(4000) 2 / Type created. SQL> create or replace procedure test_proc_type (p_type char_type) 2 is 3 begin 4 for i in 1..p_type.count loop 5 dbms_output.put_line (p_type(i) ) ; 6 end loop; 7 end; 8 / Procedure created. SQL> set serveroutput on SQL> SQL> exec test_proc_type(char_type('A','B','C','D','E')) A B C D E PL/SQL procedure successfully completed. SQL>
-
The ID of the table error duplicate
Hello
When I try to add an Array Manager, I get an error of "Table duplicate ID 'xxxxxx'" and I can not add the Bay Manager. I uninstalled and reinstalled SRM and still get the same error. Someone at - he seen this before?
Thank you
Hello
Found the answer to this. There was a problem with the table IDs to the Compellent Enterprise Manager.
Thank you.
-
If it is possible to pass the variable of type table in sceduler.
Hello
need to schedule a task to call a procedure but procedure a array as a parameter.
Let me know we can pass the type of object as a parameter in the Scheduler.
procedure definition: procedure (number, varchar2, ch. pakage.table_type b)
I don't think that you can do with a PL/SQL type in a package, but you can do it with a SQL type, as shown below.
Scott@orcl12c > test_tab CREATE TABLE
2 (col1 NUMBER,
VARCHAR2 (30) 3 col2.
col3 4 VARCHAR2 (30))
5.
Table created.
Scott@orcl12c > CREATE or REPLACE TYPE table_type AS TABLE OF VARCHAR2 (30);
2.
Type of creation.
Scott@orcl12c > test_proc CREATE OR REPLACE PROCEDURE
2 (a NUMBER;
3B VARCHAR2,
4 c. table_type)
5 AS
6 BEGIN
7 BECAUSE I have 1... c.COUNT LOOP
8 INSERT INTO test_tab (col1, col2, col3) VALUES (a, b, c (i));
9 END OF THE LOOP;
10 END test_proc;
11.
Created procedure.
Scott@orcl12c > SHOW ERRORS
No errors.
Scott@orcl12c > START
2 DBMS_SCHEDULER. CREATE_JOB
3 (job_name-online 'test_job',
job_type 4-online "procedure_stockee."
5 job_action-online 'test_proc. "
6 number_of_arguments-online 3);
7 DBMS_SCHEDULER. SET_JOB_ARGUMENT_VALUE
8 (job_name-online 'test_job',
argument_position 9-online 1.
argument_value 10-10 online);
11 DBMS_SCHEDULER. SET_JOB_ARGUMENT_VALUE
12 (job_name-online 'test_job',
13 argument_position-online 2
14 argument_value-online 'test');
15 DBMS_SCHEDULER. SET_JOB_ANYDATA_VALUE
16 ("test_job", 3, sys.anydata.convertCollection (table_type ("Oracle", "database")));
17 DBMS_SCHEDULER. SELECT ("test_job");
18 END;
19.
PL/SQL procedure successfully completed.
Scott@orcl12c > DBMS_LOCK EXEC. SLEEP (5)
PL/SQL procedure successfully completed.
Scott@orcl12c > SELECT * FROM test_tab
2.
COL1 COL2 COL3
---------- ------------------------------ ------------------------------
10 test Oracle
test 10 database
2 selected lines.
-
Creation of a value of Type Table set of 'EVERYTHING' as one of the value
Gurus,
My requirement is to create value together [table type] which would show the values [LOV] parameter of Conc Progr.
So far, we have three these values to choose from, they are 'frozen', 'pending' and 'Test '. I managed.
My question is,
If the user wants to choose 'ALL' three values, how will welcome him in this game of table type values?
Give the fourth option as ALL who would finally choose 'ALL' three values 'Frozen', 'Pending' and 'Test '.
Thanks in advance.
LDS-You can't have the UNION in the set of values.
Try to create a view, which is to have the UNION with ALL.
See the following links.
Game table of values.
ORA-00907 is missing a closing parenthesis in the valueBy
VAMSi -
Why a whole page of rows in the table is duplicate in FrameMaker 10?
I have a long table in one of my chapters in FrameMaker 10. The table is seven pages long, but a whole page of dollars of rows in the table is duplicated, if the table really should only be six pages long. The first four pages look like this:
Page 1: Lines 1-7
Page 2: Lines 8-16
Page 3: Lines 8-16
Page 4: Lines 17-28
Headers and footers are completely unaffected. All the markers from index in the rows of the table are also doubled, so all of the Page 3 index markers are also appearing in the IX file. I've combed through the file on unresolved references, but I can't find. Also, if I insert a blank line in Page 2, all lines is duplicated is no longer. If I insist on the entire table, Page 2 does not seem to be highlighted. I can't select or change anything on the Page 2.
I'm absolutely baffled why this is happening. A glimpse of what is causing this rowset ghosts to appear?
Some ideas to play with:
- Did you wash MIF file to clean small codes that may have been imported?
- Have you checked the duplicate lines to check that they are defined in the body and not header?
Maybe you are looking for
-
HP Pavilion TouchSmart 15-n029: HDMI output not working not not on HP Pavilion 15
Hi guys, I'm new here on the HP Forum. My problems started when I got my new laptop and I HATED windows 8. If one of my friends had a drive with Windows 7 above. After installation nothing worked, no WiFi, USB, HDMI and so on. I have serched the days
-
The upgrade of my RAM for my HP desktop PC
Hello I am looking to pay 2 x CORSAIR CML8GX3M1A1600C10 vengeance without buffer memory DDR3 PC - DIMM 8 GB RAM. Its got a 1600 Mhz clock frequency. PC World/curries... Currently, I had 6 GB of RAM at the moment and want to updrade it 16 GB or more.
-
BlackBerry Smartphones compatible with Priv Smartwatch
Is there a specific chip to show compatible with Priv?
-
Complete frustration with windows 7...
Seriously, nobody comes back with a fix for the problem of falling to slide under Windows 7? These positions are almost a year and I don't see no response to any questions about drag and drop for photos! We are just screwed? Just came out and had a m
-
Update from XP to 7 Professional can - system dual boot - I uninstall XP?
I upgraded from XP to 7 Professional by installing 7 on a new hard drive. This gave me a system dual boot, which I don't want. I want to remove the old hard drive on my computer and only start and use 7. I can do this now? I activated Windows 7.