How to join PLSQL nested table with normal tables ?
my requirement is to delete the rows in a normal oracle table in one statement, based on the values collected in a PL/SQL nested table which is filled by another program.
In the following example, i need to delete the rows in
the table c_journals where the columns branch_code and
id are having values which exist in the PL/SQL
nested table's columns a and b respectively
declare
type test_type IS RECORD (a VARCHAR2(20), b number(20));
type test_table is table of test_type index by binary_integer;
test_object test_table;
cnt number;
begin
test_object(1).a := '1000';
test_object(1).b := 1;
test_object(2).a := '1006';
test_object(2).b := 4;
/* to be completed */
delete c_journals where ....
end;
Is this possible in Oracle ? Iam using the version 9iR2
Thanks in advance
Both of the following delete statements should work. For the second the two types need to be created as database objects.
declare
type test_type IS RECORD (a VARCHAR2(20), b number(20));
type test_table is table of test_type index by binary_integer;
test_object test_table; -- := test_table(test_type('1000',1), test_type('1006',4));
cnt number;
begin
test_object(1).a := '1000';
test_object(1).b := 1;
test_object(2).a := '1006';
test_object(2).b := 4;
for i in test_object.first .. test_object.last loop
delete from c_journals cj
where test_object(i).a = cj.branch_code
and test_object(i).b = cj.id;
end loop;
end;
create or replace type test_type IS object (a VARCHAR2(20), b number(20));
create or replace type test_table is table of test_type;
declare
test_object test_table := test_table(test_type('1000',1), test_type('1006',4));
cnt number;
begin
delete from c_journals cj
where exists (select 'x' from table(cast(test_object as test_table)) t
where cj.branch_code = t.a and cj.id = t.b);
end;
/
Similar Messages
-
Help in joining nested table with regular table
Im creating a nested table codelist as object prtcnpt_info. In a anonymous block im declaring t_code as nested table type codelist.
Now when i try to join the nested table with the regular oracle DB table and i get error: PL/SQL: ORA-00904: "COLUMN_VALUE": invalid identifier.
Please help me on this and provide tutorial link pertaining to this concepts..Below is the code i wrote
--Code Start;
create or replace type prtcnpt_info as object ( id number
,name varchar2(200)
,code varchar2(30));
create type codelist is table of prtcnpt_info;
declare
t_code codelist;
begin
select prtcnpt_info(b.pid ,b.name ,pt.code) bulk collect into t_code
from part pt
,mc_code b
where pt.cd in ('AAA','BBB')
and pt.ptype_id=b.pt_type_id;
INSERT INTO table ( ID
,RUN_ID
,DATA
,P_ID
SELECT id
,run_id
,data
,prtct.id ----> 1
FROM table_2 t2
,(select column_value from table(t_code)) prtct
WHERE prtct.id=t2.P_ID; ------> 2
end;
--Code End;
also from the anonymous block
1 => is this correct way to get value of id (b.pid) from the nested tablet_code aliased as prtct ?
2 => is this correct way to join the nested table with regular table? i want to join the column id's in both the tables.
Edited by: 914912 on Apr 30, 2012 2:11 AMWhen you create a table type without an object, i.e. a single column type like this you will get the column name as COLUMN_VALUE.
SQL*Plus: Release 10.2.0.5.0 - Production on Mon Apr 30 07:38:32 2012
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> create or replace type mytbl as table of varchar2(10)
2 /
Type created.
SQL> var rc refcursor
"afiedt.buf" 11 lines, 162 characters
1 declare
2 ltbl mytbl;
3 begin
4 select to_char(level) bulk collect into ltbl
5 from dual
6 connect by level <= 10;
7 open :rc for
8 select * from table(ltbl);
9* end;
10 /
PL/SQL procedure successfully completed.
SQL> print rc
COLUMN_VAL
1
2
3
4
5
6
7
8
9
10
10 rows selected.And when you create a table type with object you will get the object column name.
SQL> drop type mytbl
2 /
Type dropped.
SQL> create type myobj as object (id varchar2(10))
2 /
Type created.
SQL> create type mytbl as table of myobj
2 /
Type created.
SQL> declare
2 ltbl mytbl;
3 begin
4 select myobj(to_char(level)) bulk collect into ltbl
5 from dual
6 connect by level <= 10;
7 open :rc for
8 select * from table(ltbl);
9 end;
10 /
PL/SQL procedure successfully completed.
SQL> print rc
ID
1
2
3
4
5
6
7
8
9
10
10 rows selected.
SQL> -
Join Istore table with AR tables
Hi Gurus,
How to join ibe_msites_b table with AR table. I am trying to get list of all customers from different mini sites. These are the AR tables i am using
HZ_Cust_Accounts
HZ_Parties
Regards,The following query should give you resullts for B2C. Change the query based on your requirement incase if you want it for B2B. Please note that I haven't added alll the conditions. This should be your starting point.
Hope this helps,
RK
SELECT imt.msite_name,
hp.party_name
FROM jtf_um_subscription_reg jusr,
jtf_um_subscription_resp jure,
fnd_responsibility fr,
ibe_msite_resps_b imrb,
ibe_msites_tl imt,
fnd_user fu,
hz_parties hp
WHERE jusr.subscription_id = jure.subscription_id
AND jure.responsibility_key = fr.responsibility_key
AND fr.responsibility_id = imrb.responsibility_id
AND imrb.msite_id = imt.msite_id
AND imt.language = USERENV('LANG')
AND fu.user_id =jusr.user_id
AND fu.person_party_id = hp.party_id -
How to link TCJ_Documents table with BKPF table
Dear all,
i am new ABAPer, i need to join TCJ_Documents table with BKPF table.
but, i can not find the relationship between this two tables.
so, please help !
thanks !Hi....
There is a company code (BUKRS) in both tables.
Also Fiscal year(GJAHR)...
What is the problem with that?
Sample code...
data: begin of itab occurs 0,
bukrs type bukrs,
cjnr type cjnr,
belnr type belnr_d,
end of itab.
start-of-selection.
select p~bukrs p~belnr q~comp_code from bkpf as p
inner join tcj_documents as q
on p~bukrs = q~comp_code
into table itab.
loop at itab.
write:/ itab-bukrs.
endloop.
Thanks,
Naveen.i -
How to join to window server with NIP policy
how to join to window server with NIP policy?
Since you refer to MySQL as the default database, I presume that you're talking about using PHP.
Yes, you can link to MS SQL Server - as long as you're willing to code everything by hand. If you're looking for automated code generation, though, the answer is no.
Even the default PHP/MySQL server behaviors are not really worth considering for professional web development. They're fine for quick prototyping, but they use deprecated functions that are not suitable for a production environment. -
Linking user table with system table
Hello, I'm trying to link a user table with IC table in order to asign many sales person to a customer.
I've created a new button in the IC form. When clicked a new form is opened to asign sales person to the IC. Now I need to retrieve the records assigned to this IC. How can I do that???
Regards.
Angel.Hi Angel,
I would put a matrix in the new form where you could see/asign/delete the sales person.
Have a look at this post where you can find a great code from Sebastian Danober to fill a matrix from a recordset.
Another option could be to modify the existing IC form and add a new folder with a matrix where you can manage the sales person.
Check this other post with code for adding folder to an existing form.
Regards,
Ibai Peñ -
Mix object tables with relational tables?
Hallo,
is it possible to mix object tables with relational tables in one database?
I didn't succeed in assigning a foreign key from a relational table to an object table.
Is this only working with column objects in relational tables?Hi
is it possible to mix object tables with relational tables in one database?
Every database contains both types of tables. So, it is basically not a problem.
I didn't succeed in assigning a foreign key from a relational table to an object table.
Is this only working with column objects in relational tables?It would be interesting to know how you tried... e.g. what error you get... Here an example (executed on 11.1).
SQL> create or replace type tt as object ( n number );
2 /
SQL> create table ot of tt (constraint ot_pk primary key (n));
SQL> create table rt (n number, constraint rt_ot_fk foreign key (n) references ot (n));
SQL> insert into ot values (tt(1));
SQL> insert into rt values (1);
SQL> insert into rt values (2);
insert into rt values (2)
ERROR at line 1:
ORA-02291: integrity constraint (OPS$CHA.RT_OT_FK) violated - parent key not foundHTH
Chris -
Is any one created Table with in table using adv table with VOs without EOs
If you have created Advnace table Master-Detail (Table with in table), please let me know the Controller code. I am using below. But getting Nullpointer excveption at innerTable.setAttributeValue(VIEW_LINK_NAME,"ViewLink1VL"); Please help me.
===========================
OAWebBean outerTable = (OAWebBean)webBean.findChildRecursive("region2");
OAWebBean innerTable = (OAWebBean)webBean.findChildRecursive("region4");
if (outerTable != null)
outerTable.setAttributeValue(CHILD_VIEW_ATTRIBUTE_NAME,"FLEX_VALUE_X");
outerTable.setAttributeValue(VIEW_LINK_NAME,"ViewLink1VL");
if (innerTable != null)
innerTable.setAttributeValue(CHILD_VIEW_ATTRIBUTE_NAME,"FLEX_VALUE_X");
innerTable.setAttributeValue(VIEW_LINK_NAME,"ViewLink1VL");
OAApplicationModule am = pageContext.getApplicationModule(webBean);
am.invokeMethod("initGoodsQuery");
============================My problem was solved when i used ,"ViewLink1VL1" instead of ,"ViewLink1VL" in controller code.
thanks.
Gopi. -
How to Compare Data length of staging table with base table definition
Hi,
I've two tables :staging table and base table.
I'm getting data from flatfiles into staging table, as per requirement structure of staging table and base table(length of each and every column in staging table is 25% more to dump data without any errors) are different for ex :if we've city column with varchar length 40 in staging table it has 25 in base table.Once data is dumped into staging table I want to compare actual data length of each and every column in staging table with definition of base table(data_length for each and every column from all_tab_columns) and if any column differs length I need to update the corresponding row in staging table which also has a flag called err_length.
so for this I'm using cursor c1 is select length(a.id),length(a.name)... from staging_table;
cursor c2(name varchar2) is select data_length from all_tab_columns where table_name='BASE_TABLE' and column_name=name;
But we're getting data atonce in first query whereas in second cursor I need to get each and every column and then compare with first ?
Can anyone tell me how to get desired results?
Thanks,
Mahender.This is a shot in the dark but, take a look at this example below:
SQL> DROP TABLE STAGING;
Table dropped.
SQL> DROP TABLE BASE;
Table dropped.
SQL> CREATE TABLE STAGING
2 (
3 ID NUMBER
4 , A VARCHAR2(40)
5 , B VARCHAR2(40)
6 , ERR_LENGTH VARCHAR2(1)
7 );
Table created.
SQL> CREATE TABLE BASE
2 (
3 ID NUMBER
4 , A VARCHAR2(25)
5 , B VARCHAR2(25)
6 );
Table created.
SQL> INSERT INTO STAGING VALUES (1,RPAD('X',26,'X'),RPAD('X',25,'X'),NULL);
1 row created.
SQL> INSERT INTO STAGING VALUES (2,RPAD('X',25,'X'),RPAD('X',26,'X'),NULL);
1 row created.
SQL> INSERT INTO STAGING VALUES (3,RPAD('X',25,'X'),RPAD('X',25,'X'),NULL);
1 row created.
SQL> COMMIT;
Commit complete.
SQL> SELECT * FROM STAGING;
ID A B E
1 XXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXX
2 XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
3 XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXX
SQL> UPDATE STAGING ST
2 SET ERR_LENGTH = 'Y'
3 WHERE EXISTS
4 (
5 WITH columns_in_staging AS
6 (
7 /* Retrieve all the columns names for the staging table with the exception of the primary key column
8 * and order them alphabetically.
9 */
10 SELECT COLUMN_NAME
11 , ROW_NUMBER() OVER (ORDER BY COLUMN_NAME) RN
12 FROM ALL_TAB_COLUMNS
13 WHERE TABLE_NAME='STAGING'
14 AND COLUMN_NAME != 'ID'
15 ORDER BY 1
16 ), staging_unpivot AS
17 (
18 /* Using the columns_in_staging above UNPIVOT the result set so you get a record for each COLUMN value
19 * for each record. The DECODE performs the unpivot and it works if the decode specifies the columns
20 * in the same order as the ROW_NUMBER() function in columns_in_staging
21 */
22 SELECT ID
23 , COLUMN_NAME
24 , DECODE
25 (
26 RN
27 , 1,A
28 , 2,B
29 ) AS VAL
30 FROM STAGING
31 CROSS JOIN COLUMNS_IN_STAGING
32 )
33 /* Only return IDs for records that have at least one column value that exceeds the length. */
34 SELECT ID
35 FROM
36 (
37 /* Join the unpivoted staging table to the ALL_TAB_COLUMNS table on the column names. Here we perform
38 * the check to see if there are any differences in the length if so set a flag.
39 */
40 SELECT STAGING_UNPIVOT.ID
41 , (CASE WHEN ATC.DATA_LENGTH < LENGTH(STAGING_UNPIVOT.VAL) THEN 'Y' END) AS ERR_LENGTH_A
42 , (CASE WHEN ATC.DATA_LENGTH < LENGTH(STAGING_UNPIVOT.VAL) THEN 'Y' END) AS ERR_LENGTH_B
43 FROM STAGING_UNPIVOT
44 JOIN ALL_TAB_COLUMNS ATC ON ATC.COLUMN_NAME = STAGING_UNPIVOT.COLUMN_NAME
45 WHERE ATC.TABLE_NAME='BASE'
46 ) A
47 WHERE COALESCE(ERR_LENGTH_A,ERR_LENGTH_B) IS NOT NULL
48 AND ST.ID = A.ID
49 )
50 /
2 rows updated.
SQL> SELECT * FROM STAGING;
ID A B E
1 XXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXX Y
2 XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX Y
3 XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXHopefully the comments make sense. If you have any questions please let me know.
This assumes the column names are the same between the staging and base tables. In addition as you add more columns to this table you'll have to add more CASE statements to check the length and update the COALESCE check as necessary.
Thanks! -
Join Absence Tables with Transaction Tables
Dears,
i need to join (PER_ABSENCE_ATTENDANCES) with (HR_API_TRANSACTIONS) Tables. how to achieve this?
Thank youDear Sanjay,
Can you explain more. my Trigger:
CREATE OR REPLACE TRIGGER APPS.GM_TIME_ATTENDNCE
AFTER DELETE OR INSERT
ON HR.PER_ABSENCE_ATTENDANCES
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
IF INSERTING THEN
IF ( :NEW.ABSENCE_ATTENDANCE_TYPE_ID = 10062 ) THEN
GM_TIME_PKG.CREATE_ELEMENT_ENTRY(:NEW.ABSENCE_ATTENDANCE_ID,:NEW.PERSON_ID,:NEW.DATE_START,:NEW.DATE_END,TO_CHAR(:NEW.TIME_START),TO_CHAR(:NEW.TIME_END),:NEW.ABSENCE_HOURS);
ELSE
NULL;
END IF;
ELSIF DELETING THEN
IF ( :OLD.ABSENCE_ATTENDANCE_TYPE_ID = 10062 ) THEN
GM_TIME_PKG.DELETE_ELEMENT_ENTRY(:OLD.ABSENCE_ATTENDANCE_ID);
ELSE
NULL;
END IF;
END IF;
COMMIT;
END;
Thank you
Edited by: user8013866 on Jun 3, 2013 4:42 AM -
How can I bind a operation with a table
Hi !
I'm trying to bind a operation with a table, so what type of operation return ? ViewObject or a Vector? And how can i set params to these operation if my operation has some param ( getSubscriber(int iSubId, int iSubType) )
Thank a lot for your helpHi,
it depends on the release you are asking this question for. In JDeveloper 10.1.3 you can expose a method (e.g. on a session facade) that returns a Collection. The input parameters can be dragged and dropped as input fields to the page.
The same can be done in JDeveloper 10.1.2, but here you have to prgrammatically apply the input arguments.
Frank -
How to generate a customized report with a table
I have a table with two columns: month, count. The values are like the following:
Jan-2007 50
Feb-2007 46
Mar-2007 55
Apr-2007 76
Jan-2009 67
Feb-2009 86
Mar-2009 55
I want to generate a report like this:
Month 2007 2008 2009
January 50 76 67
Febuary 46 45 86
How to do that?
Thanks.
JenJen,
This is the best way I could come up with. It is a little clunky but it gets the job done. Basically it buckets each group by month and then unions each month together. I used the column names and formats you specified so you should only have to change the table name.
EDIT
You may want to do a nvl on each decode that way the sums will work correctly for nulls. Also, you could generate this sql statement procedurally and save yourself some maintenance time. This was just to show you how it could be approached.
SELECT 'January' "Month",
SUM(DECODE(substr(month,5,4),2000,count)) "2000",
SUM(DECODE(substr(month,5,4),2001,count))"2001",
SUM(DECODE(substr(month,5,4),2002,count))"2002",
SUM(DECODE(substr(month,5,4),2003,count))"2003",
SUM(DECODE(substr(month,5,4),2004,count))"2004",
SUM(DECODE(substr(month,5,4),2005,count))"2005",
SUM(DECODE(substr(month,5,4),2006,count))"2006",
SUM(DECODE(substr(month,5,4),2007,count))"2007",
SUM(DECODE(substr(month,5,4),2008,count))"2008",
SUM(DECODE(substr(month,5,4),2009,count))"2009" FROM TYSON_TEST_TABLE
WHERE substr(month,1,3) = 'JAN'
GROUP BY 'January'
UNION ALL
SELECT 'February' "Month",
SUM(DECODE(substr(month,5,4),2000,count)) "2000",
SUM(DECODE(substr(month,5,4),2001,count))"2001",
SUM(DECODE(substr(month,5,4),2002,count))"2002",
SUM(DECODE(substr(month,5,4),2003,count))"2003",
SUM(DECODE(substr(month,5,4),2004,count))"2004",
SUM(DECODE(substr(month,5,4),2005,count))"2005",
SUM(DECODE(substr(month,5,4),2006,count))"2006",
SUM(DECODE(substr(month,5,4),2007,count))"2007",
SUM(DECODE(substr(month,5,4),2008,count))"2008",
SUM(DECODE(substr(month,5,4),2009,count))"2009" FROM TYSON_TEST_TABLE
WHERE UPPER(substr(month,1,3)) = 'FEB'
GROUP BY 'February'
UNION ALL
SELECT 'March' "Month",
SUM(DECODE(substr(month,5,4),2000,count)) "2000",
SUM(DECODE(substr(month,5,4),2001,count))"2001",
SUM(DECODE(substr(month,5,4),2002,count))"2002",
SUM(DECODE(substr(month,5,4),2003,count))"2003",
SUM(DECODE(substr(month,5,4),2004,count))"2004",
SUM(DECODE(substr(month,5,4),2005,count))"2005",
SUM(DECODE(substr(month,5,4),2006,count))"2006",
SUM(DECODE(substr(month,5,4),2007,count))"2007",
SUM(DECODE(substr(month,5,4),2008,count))"2008",
SUM(DECODE(substr(month,5,4),2009,count))"2009" FROM TYSON_TEST_TABLE
WHERE substr(month,1,3) = 'MAR'
GROUP BY 'March'
UNION ALL
SELECT 'April' "Month",
SUM(DECODE(substr(month,5,4),2000,count)) "2000",
SUM(DECODE(substr(month,5,4),2001,count))"2001",
SUM(DECODE(substr(month,5,4),2002,count))"2002",
SUM(DECODE(substr(month,5,4),2003,count))"2003",
SUM(DECODE(substr(month,5,4),2004,count))"2004",
SUM(DECODE(substr(month,5,4),2005,count))"2005",
SUM(DECODE(substr(month,5,4),2006,count))"2006",
SUM(DECODE(substr(month,5,4),2007,count))"2007",
SUM(DECODE(substr(month,5,4),2008,count))"2008",
SUM(DECODE(substr(month,5,4),2009,count))"2009" FROM TYSON_TEST_TABLE
WHERE UPPER(substr(month,1,3)) = 'APR'
GROUP BY 'April'
UNION ALL
SELECT 'May' "Month",
SUM(DECODE(substr(month,5,4),2000,count)) "2000",
SUM(DECODE(substr(month,5,4),2001,count))"2001",
SUM(DECODE(substr(month,5,4),2002,count))"2002",
SUM(DECODE(substr(month,5,4),2003,count))"2003",
SUM(DECODE(substr(month,5,4),2004,count))"2004",
SUM(DECODE(substr(month,5,4),2005,count))"2005",
SUM(DECODE(substr(month,5,4),2006,count))"2006",
SUM(DECODE(substr(month,5,4),2007,count))"2007",
SUM(DECODE(substr(month,5,4),2008,count))"2008",
SUM(DECODE(substr(month,5,4),2009,count))"2009" FROM TYSON_TEST_TABLE
WHERE substr(month,1,3) = 'MAY'
GROUP BY 'May'
UNION ALL
SELECT 'June' "Month",
SUM(DECODE(substr(month,5,4),2000,count)) "2000",
SUM(DECODE(substr(month,5,4),2001,count))"2001",
SUM(DECODE(substr(month,5,4),2002,count))"2002",
SUM(DECODE(substr(month,5,4),2003,count))"2003",
SUM(DECODE(substr(month,5,4),2004,count))"2004",
SUM(DECODE(substr(month,5,4),2005,count))"2005",
SUM(DECODE(substr(month,5,4),2006,count))"2006",
SUM(DECODE(substr(month,5,4),2007,count))"2007",
SUM(DECODE(substr(month,5,4),2008,count))"2008",
SUM(DECODE(substr(month,5,4),2009,count))"2009" FROM TYSON_TEST_TABLE
WHERE UPPER(substr(month,1,3)) = 'JUN'
GROUP BY 'June'
UNION ALL
SELECT 'July' "Month",
SUM(DECODE(substr(month,5,4),2000,count)) "2000",
SUM(DECODE(substr(month,5,4),2001,count))"2001",
SUM(DECODE(substr(month,5,4),2002,count))"2002",
SUM(DECODE(substr(month,5,4),2003,count))"2003",
SUM(DECODE(substr(month,5,4),2004,count))"2004",
SUM(DECODE(substr(month,5,4),2005,count))"2005",
SUM(DECODE(substr(month,5,4),2006,count))"2006",
SUM(DECODE(substr(month,5,4),2007,count))"2007",
SUM(DECODE(substr(month,5,4),2008,count))"2008",
SUM(DECODE(substr(month,5,4),2009,count))"2009" FROM TYSON_TEST_TABLE
WHERE substr(month,1,3) = 'JUL'
GROUP BY 'July'
UNION ALL
SELECT 'August' "Month",
SUM(DECODE(substr(month,5,4),2000,count)) "2000",
SUM(DECODE(substr(month,5,4),2001,count))"2001",
SUM(DECODE(substr(month,5,4),2002,count))"2002",
SUM(DECODE(substr(month,5,4),2003,count))"2003",
SUM(DECODE(substr(month,5,4),2004,count))"2004",
SUM(DECODE(substr(month,5,4),2005,count))"2005",
SUM(DECODE(substr(month,5,4),2006,count))"2006",
SUM(DECODE(substr(month,5,4),2007,count))"2007",
SUM(DECODE(substr(month,5,4),2008,count))"2008",
SUM(DECODE(substr(month,5,4),2009,count))"2009" FROM TYSON_TEST_TABLE
WHERE UPPER(substr(month,1,3)) = 'AUG'
GROUP BY 'August'
UNION ALL
SELECT 'September' "Month",
SUM(DECODE(substr(month,5,4),2000,count)) "2000",
SUM(DECODE(substr(month,5,4),2001,count))"2001",
SUM(DECODE(substr(month,5,4),2002,count))"2002",
SUM(DECODE(substr(month,5,4),2003,count))"2003",
SUM(DECODE(substr(month,5,4),2004,count))"2004",
SUM(DECODE(substr(month,5,4),2005,count))"2005",
SUM(DECODE(substr(month,5,4),2006,count))"2006",
SUM(DECODE(substr(month,5,4),2007,count))"2007",
SUM(DECODE(substr(month,5,4),2008,count))"2008",
SUM(DECODE(substr(month,5,4),2009,count))"2009" FROM TYSON_TEST_TABLE
WHERE substr(month,1,3) = 'SEP'
GROUP BY 'September'
UNION ALL
SELECT 'October' "Month",
SUM(DECODE(substr(month,5,4),2000,count)) "2000",
SUM(DECODE(substr(month,5,4),2001,count))"2001",
SUM(DECODE(substr(month,5,4),2002,count))"2002",
SUM(DECODE(substr(month,5,4),2003,count))"2003",
SUM(DECODE(substr(month,5,4),2004,count))"2004",
SUM(DECODE(substr(month,5,4),2005,count))"2005",
SUM(DECODE(substr(month,5,4),2006,count))"2006",
SUM(DECODE(substr(month,5,4),2007,count))"2007",
SUM(DECODE(substr(month,5,4),2008,count))"2008",
SUM(DECODE(substr(month,5,4),2009,count))"2009" FROM TYSON_TEST_TABLE
WHERE UPPER(substr(month,1,3)) = 'OCT'
GROUP BY 'October'
UNION ALL
SELECT 'November' "Month",
SUM(DECODE(substr(month,5,4),2000,count)) "2000",
SUM(DECODE(substr(month,5,4),2001,count))"2001",
SUM(DECODE(substr(month,5,4),2002,count))"2002",
SUM(DECODE(substr(month,5,4),2003,count))"2003",
SUM(DECODE(substr(month,5,4),2004,count))"2004",
SUM(DECODE(substr(month,5,4),2005,count))"2005",
SUM(DECODE(substr(month,5,4),2006,count))"2006",
SUM(DECODE(substr(month,5,4),2007,count))"2007",
SUM(DECODE(substr(month,5,4),2008,count))"2008",
SUM(DECODE(substr(month,5,4),2009,count))"2009" FROM TYSON_TEST_TABLE
WHERE substr(month,1,3) = 'NOV'
GROUP BY 'November'
UNION ALL
SELECT 'December' "Month",
SUM(DECODE(substr(month,5,4),2000,count)) "2000",
SUM(DECODE(substr(month,5,4),2001,count))"2001",
SUM(DECODE(substr(month,5,4),2002,count))"2002",
SUM(DECODE(substr(month,5,4),2003,count))"2003",
SUM(DECODE(substr(month,5,4),2004,count))"2004",
SUM(DECODE(substr(month,5,4),2005,count))"2005",
SUM(DECODE(substr(month,5,4),2006,count))"2006",
SUM(DECODE(substr(month,5,4),2007,count))"2007",
SUM(DECODE(substr(month,5,4),2008,count))"2008",
SUM(DECODE(substr(month,5,4),2009,count))"2009" FROM TYSON_TEST_TABLE
WHERE UPPER(substr(month,1,3)) = 'DEC'
GROUP BY 'December'Edited by: Tyson Jouglet on Mar 17, 2009 9:27 AM -
Join EQUI table with other table so as get address detail.
Hi All,
Can any one help me in the following case :
I have to pass Equipment No. EQUNR on the selection screen and get Address detail (city, region, state, country, zipcode )
now I am getting all this address related field in KNA1 table. Also I am able to join this two table with
KNA1-KUNNR join EQUI-KUNDE as common field.
Turning point
when I am passing test data of Equipment No. EQUNR 60099204 I am not getting the address detail,
because after passing EQUNR I am not getting KUNNR.
So can any one please help me in joining EQUI table to some other table with field name so that I can get the address detail.
ThanksHi,
The join between the table EQUI-kunde join KNA1-kunnr is ok but it not working for every value.
Example :-
In EQUI table when we pass Equnr - 60099204 we need to get some value in KUNDE field, then only it will join to KNA1 table. But this is not happening, I am not getting value for KUNDE, hence join is not performing.
So I need some other solution so that when we pass EQunr we can get the address details
one thing more equnr 60099204 is having address detail, if we'll check IE03 (transaction by clicking address envelop)
Thx. -
How to create table with existing table structure
How to do if i need a table with exactl similar structure of table mara?How to create it?
Hi,
In SE11 there will be a button Copy Table.
Regards,
Satish -
How to compare text box value with the table data??
Hello ALL,
I created one stored procedure in DB,it is as follows:-
CREATE or replace PROCEDURE chkUser
u in varchar2,
p in varchar2,
ap out varchar2
is
begin
select count(*) into ap from tbuser where loginid = u and password = p;
end;
And at the front end I have designed a form with 2 text boxes, now my question is I wanna compare these text box values(which user enters) with the data of the table....??? something like control (may be I am not sure)..... ???
If anybody can help me out with this issue...... help will be appreciated
Thank you.
regards,
Kumarhi Elise,
I'm always getting the Error Message as "Invalid Creditianls"... let me tell you the whole scenario with sql synatx.
I have created tables as:-
CREATE TABLE "TBUSER"
( "LOGINID" VARCHAR2(30) NOT NULL ENABLE,
"PASSWORD" VARCHAR2(30),
CONSTRAINT "TBUSER_PK" PRIMARY KEY ("LOGINID") ENABLE
than I created the Procedure on tbuser, it is as:-
create or replace PROCEDURE logincheck
u in varchar2,
p in varchar2,
ap out varchar2
is
begin
select count(*) into ap from tbuser where loginid = u and password = p;
end;
now at the front end side I have created one form with 2 text boxes (P8_USERNAME & P8_PASSWORD) and 2 buttons (Cancel and Submit)
as per you told me in the above post, I have created 'Validation' procedure with Type as 'Exists' and expression(into Validation Expression1)as:-
select 1 from tbuser
where loginid = :P8_USERNAME
and password = :P8_PASSWORD;
and
kept an error message as 'Invalid credentials'.....
but I don't know what's going wrong..... I do have few data into the table, and when I am entering the same data(with case sensitive) I am getting the Error message, rather than when the credentials are perfect user should be allowed to enter into the current page(where I have created this form and validation procedure)....
any idea what's going worng and where...????
thxs.... appreciated..
regards,
Kumar
Maybe you are looking for
-
What happens to the old phone at the time one gets (upgrades) to the 3G?
So, I understand that the old phone stops working when you upgrade to the 3G, as they will transfer your number to it's SIM. I am wondering how instantaneous it is, and what actually happens, i.e. is displayed on the old phone. I am thinking of upgra
-
How can I copy the iPhone backup files to another iTunes Library?
I'm changing to my Window laptop from a PC. I want to copy my iPhone backup to the Library in the laptop. How can I find those backup files? I don't want to lose my apps and everything, you know.
-
Our system is configured to issue warning messages when the 80% and 90% budget consumption level is reached. The problem is that both percentages use the same message number FMAVC006. Is it possible for each consumption level to use its own unique me
-
Is there auto scrolling in iBook?
Back in the day I had a palm pilot with an ereader. It had autscrolling which was the best feature in ebooks. I haven't found this in any of the iBooks or kindle readers yet. I'm surprised.
-
Captivate Books and Training?
I just bought Captivate 3. The tutorials seem to be very generic and I want to become an expert user. I don't see Adobe classes or books for training. Can anyone recommend some resources for making a newbee into and expert?