Writing sql in adf bc
hi,
Now i'm doing my final year project(6 months) and currntly i'm doing project in adf faces business components with jsf . here i want full demo to create jsf page using adf faces upto database linking includes dml options behind the adf button(any) component. how do i write sql query in adf faces. please reply me soon.
With regards
SAN
Create a new fusion web application
Connect to a database (View menu - Database Navigator)
In the model project you can create view objects using sql query
In the view controller project create jsf pages (just to learn you can use task flows for navigation)
From the Data Controls palette drag n drop as forms, multiple selections, single selections, table or tree component.
First of all I would go through tutorials. Good luck!
Similar Messages
-
How to custom SQL in ADF JDeveloper 10.1.3.3
How to custom SQL in ADF JDeveloper 10.1.3.3 as follows,
SELECT A.attribute1,
A.attribute2,
B.attribute1,
B.attribute2,
FROM table1 A,
table2 B
WHERE A.id = B.id
Thanks
sumuryHi,
this isn't really a question as it is not obvious where you want to customize it. My initial idea was to suggest SQL Worksheet to you, but then this most likely isn't what you are looking for.
http://blogs.oracle.com/shay/2007/03/02
Frank -
How to create text fields & assign values form sql in ADF
Hi all,
I am new to oracle ADF,
i want know how to create text fileds and how to assign the values to those fields from plsql.
Regards
Prakashhttp://technology.amis.nl/blog/3315/creating-an-adf-application-based-on-plsql-api-part-one-reading-data-as-a-collection-of-sql-type-objects
Hope this will help.
~Krithika -
Help needed in writing SQL CASE or DECODE statement
Hi experts,
I need to write a SQL to select order_num, cntry_cde, prod_id and Qty by joining order_num on PROD_ORDER and PROD_ORDER_TXT.
Here is my sample data
PRODORDER_
order_num cntry_cde Prod_id Qty
100 US A1 5
101 US A2 10
102 AU A3 4
103 AU A4 9
104 IN A5 3
PRODORDER_TXT_
order_num cntry_cde Prod_id
100 US A1
101 US A2
102 NZ A3
103 AU A4
104 A5
Here is the requirement,
1) If the cntry_cde in PROD_ORDER is same as cntry_cde in PROD_ORDER_TXT then select PROD_ORDER.cntry_cde (orders 100, 101, 103)
2) If they are different, pick the country code from PROD_ORDER_TXT (order 102, AU <> NZ)
3) If they are different and PROD_ORDER_TXT.cntry_cde is NULL, I cannot use it as cntry_cde in my report (order 104). It happenend just because of the bad data at source.
I cannot avoid it. Then simply use the cntry_cde from PROD_ORDER
Output expected
100 US A1 5
101 US A2 10
102 NZ A3 4 -- AU changed to NZ
103 AU A4 9
104 IN A5 3 -- IN retained as PROD_ORDER_TXT.cntry_cde is null
sample table creation and insert statements are below
create table prod_order
(order_num number,
cntry_cde CHAR(2),
prod_id VARCHAR2(6),
qty number)
create table prod_order_txt
(order_num number,
cntry_cde CHAR(2),
prod_id VARCHAR2(6))
insert into prod_order values (100, 'US', 'A1',5);
insert into prod_order values (101, 'US', 'A2',1);
insert into prod_order values (102, 'AU', 'A3',4);
insert into prod_order values (103, 'AU', 'A4',9);
insert into prod_order values (104, 'IN', 'A5',3);
insert into prod_order_txt values (100,'US','A1');
insert into prod_order_txt values (101,'US','A2');
insert into prod_order_txt values (102,'NZ','A3');
insert into prod_order_txt values (103,'AU','A4');
insert into prod_order_txt values (104,NULL,'A5');
commit;
Thanks for your help in advance
Edited by: sarvan on Mar 28, 2012 1:39 PMHello
Thank you for posting all of the ddl and test data along with your expected output - very helpful!. One small point would be to remember to type {noformat}{noformat} before and after any section of code or data in your post so that formatting is retained. Anyway, this should be a simple join and a combination of CASE and NVL...Select
po.order_num,
CASE
WHEN po.cntry_cde != NVL(pot.cntry_cde,po.cntry_cde)
THEN
pot.cntry_cde
ELSE
po.cntry_cde
END cntry_code,
po.prod_id,
po.qty
FROM
prod_order po
JOIN
prod_order_txt pot
ON
( po.order_num = pot.order_num
ORDER_NUM CN PROD_I QTY
100 US A1 5
101 US A2 1
102 NZ A3 4
103 AU A4 9
104 IN A5 3
5 rows selected.
HTH
David
Edited by: Bravid on Mar 28, 2012 8:32 AM
corrected != -
Writing SQL at backend Vs writing in middle/front end layer
Dear all,
Are their any performance differences if we write the simple sql queries at backend Vs front end/middf for populating the list boxes? e.g. select department code, department name from department
Regards,
VinayAll things being equal (i.e. the same query etc), then the query that runs "inside" the database should be a "bit" faster (obviously the definition of "bit" will vary depending on what the query actually does).
I'd also say that keeping code like that inside the database means that it's more maintainable and could well perform a lot better due to making better use of bind variables (i.e. one central place for that query versus X different app servers calling the query in different ways).
It also means that if you decide to move from using product X to product Y to rewrite your front end/middle tier then you don't have to rewrite all of the SQL again (since it's inside the database, where it should be).
Hope this helps. -
Hi evrybody,
I have a requirement which seems very wierd to me, I m unable to clue it also. Please help me in writing the same.
I have a column in a table which contains the data with spaces and everythng same as below:
SUBSCRIBER LINE TEST
VERSION 2
DEV SNB MP FCODE
LIBA-13 4222430012 11 3
FOREIGN VOLTAGE TESTS
DC AC
FVAE FVBE FVAB FVAE FVBE FVAB
LACC LACC 7.4 0.1 0.1 0.1
0.0 0.0 PASS PASS PASS PASS
PASS PASS
INSULATION RESISTANCE TESTS
IRAE IRBE IRABA IRBBA IRAB
LACC LACC LACC LACC 8113K
10000K >10000K >10000K >10000K PASSPASS PASS PASS PASS
CAPACITANCE MEASUREMENTS
CAE CBE CAB BRK
LACC LACC 4428 NO
68 72
NT LOOPBACK TEST
PASS
NT DC SIGNATURE TEST
V-HIGH V-LOW
83.920K LACC
PASS >10000K
PASS
NT CONNECTED
INV
CIRCUIT TEST RESULT
FAIL
I need to get the o/p as:
FVAELACC=0.0 FVBELACC=0.0 FVAB=7.4 FVAE=0.1 FVBE=0.1 FVAB=0.1
CAELACC=68 CBELACC=72 CAB=4428
NT CONNECTED=INV..
Thanks in advance.Evrybody thanks for advices. My Question is little unclear but the requirement is that itself.. Anyways I got the O/p finally.
Mr. Shahzad ,if any of the questions makes u feel like wasting ur technical time, jus donot read it.. The people who can undertsand the problem, they can answer to the post. If the requirement is like that, none of us are helpless. -
Select Statement (pl/sql) in ADF
Hi,
I am new in ADF.
Please give any idea or sample code about how to write Select Statement in ADF and how can i catch value.
ThanksThanks for reply
But i don't want to use View Object.
Is there another way like below insert code
public void insertTable() {
//System.out.println("OK");
DBTransaction trans = getDBTransaction();
CallableStatement statement = null;
String plsql =
"DECLARE "
+ "PRAGMA AUTONOMOUS_TRANSACTION; "
+"BEGIN "
+ "INSERT INTO test_check "
+ "(id,name) "
+ "VALUES (?,?); "
+ "COMMIT; "
+"END;";
statement = trans.createCallableStatement(plsql,DBTransaction.DEFAULT);
try {
statement.setInt(1,"001");
statement.setString(2, "user10892984");
int rows = statement.executeUpdate();
} catch (SQLException e) {
throw new JboException(e);
} finally {
try {
if (statement != null)
statement.close();
} catch (SQLException e) {System.out.println("Not Insert.......");
} -
Writing SQL queries in BAM Reports
Hi,
Is it possible to write SQL queries in BAM Reports.
thanksDepends on the version of BAM u are using
For version 10.1.3.X u can use enterprise link or External data Source...
FOr 11g u can use ODI or External Data Source ...
Depends upon what is ur SQL doing -
Writing SQL statements in piublic methods
Why shouldnt i write my sql statements in the public method itself rather than directing it to a private method and access the data base?
There's nothing specific about a SQL statement that means you should treat it differently to any other piece of code.
Place it in a public method if you want it to be visible outside the class and don't mind if a subclass overrides it. If you do care about the subclasses overriding you can make the method final.
Place it in a private method if it should only be called as part of the internal logic of the class and there is no need for subclasses to override the behaviour. -
I am getting small erro when i am writing sql query
hi all
in dashboard prompts i am trying to write small query (select 1 from dual) in sql request
but i am getting following error
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27004] Unresolved table: "dual". (HY000)
SQL Issued: select 1 from dual
my problem is i want to put result of function in the prompt so, i am testing with small one
so hw can i call the function from prompts
select updae_fn(pp,rr) from dual
but it is giving an error that is syntax error '(' is missing but that was there
Thanks
Sreedharhi ,
Dual is not supported by OBIEE
select updae_fn(pp,rr) from dualUSe evaluate function and include the function
http://oracle-bi.siebelunleashed.com/articles/callingdb-function-in-obiee/
thanks,
Saichand.v
Edited by: Saichand Varanasi on Oct 7, 2010 12:48 PM -
Hello,
I have a string like a:b:c:d:e:f
I would like to fetch a and b values as 2 separate columns.
Using oracle 10g.
ThanksTry:
SQL> variable test_str varchar2(20)
SQL> exec :test_str :='a:b:c:d:e:f';
PL/SQL procedure successfully completed.
SQL> ed
Wrote file afiedt.buf
1 select
2 trim( substr (txt,
3 instr (txt, ':', 1, level ) + 1,
4 instr (txt, ':', 1, level+1)
5 - instr (txt, ':', 1, level) -1 ) )
6 as token
7 from (select ':'||:test_str||':' txt
8 from dual)
9 connect by level <=
10* length(:test_str)-length(replace(:test_str,':',''))+1
SQL> /
TOKEN
a
b
c
d
e
f
6 rows selected. -
I get a monthly data feed in excel with pcpid and memberid information.I'm supposed to get member detail information for all the members associated only with the pcpid in the spreadsheet
How do i write a query so that i associate a memberid only with the pcpid given in the spreadsheet
The problem iam having is when i write a query to bring the member information by providing pcpid in list , i get multiple records for a member as the member might earlier be associated with another PCPid
Data From Excel
Member No PCP ID
101 A
102 B
103 C
104 D
When i insert these values in to the query to get remaining member Details below is how the data looks
Member No PCP ID
101 A
101 B
101 D
102 A
102 B
103 A
103 C
104 B
104 D
Please Advice.
thanks.SQL and PL/SQL FAQ
I have no idea what data is in the DB & no idea what the result set should be or why? -
i am trying to write sql query for a single recordset.
I have an items table with all the standard item info and an item_colorID.
i have a color_lookup table with 2 columns, item_colorID and color_ID
i have a colors table with 2 columns, color_ID and color
i want to join the tables and filter it so that a repeat region shows dynamic data of item name, description, thumb, price
and also a list/menu dynamically populated by color
filtered so that each item shows in the list/menu only the colors that the item has available.
i have tried different variations of this sql
SELECT * FROM items INNER JOIN color_lookup ON color_lookup.item_colorID = items.item_colorID INNER JOIN colors ON colors.color_ID = color_lookup.color_ID WHERE items.itemCatID = 3 ORDER BY items.itemName
but the list/menu shows every color choice multiplied by the number of items in that color
ie White will show 80+ times.
thanks for your help,
jim balthropbregent,
thanks for your help.
I am building a shopping cart and i have a recordset to list the items and a repeat region for that recordset
i have a second recordset for the colors joined to the item_colorID nested inside the repeat region.
the shopping cart software has a 'lookup from recordset' choice for the add to cart servior behavior
and then i bind to the columns on the cart page.
it produces this code
if (isset($totalRows_rs_itemscat3) && $totalRows_rs_itemscat3 > 0) {
$row_rs_itemscat3 = WAEC_findRecordMySQL($rs_itemscat3, "item_ID", $ATC_itemID);
if ($row_rs_itemscat3) {
$ATC_itemName = "".$row_rs_itemscat3['itemName'] ."";// column binding
$ATC_itemDescription = "".$row_rs_itemscat3['itemShortDesc'] ."";// column binding
$ATC_itemWeight = floatval("".$row_rs_itemscat3['itemWeight'] ."");// column binding
$ATC_itemQuantity = "".$_POST["Farrington_1_Quantity_Add"] ."";// column binding
$ATC_itemPrice = floatval("".$row_rs_itemscat3['itemPrice'] ."");// column binding
$ATC_itemThumbnail = "".$row_rs_itemscat3['itemThumb'] ."";// column binding
$ATC_itemcolorchoice = "".$row_rs_colors['color'] ."";// column binding
mysql_data_seek($rs_itemscat3, 0);
$row_rs_itemscat3 = mysql_fetch_assoc($rs_itemscat3);
the column binding for the colors is from a different recordset and when redirecting to the cart page the color info will not show.
So my thinking is if i could get the color list/menu to populate from the same recordset as the item listing, it would solve my add to cart server behavior.
Is it possible to do this with only one recordset?
the products page and the cart page can be seen
http://www.farrington-enterprises.com/rain-gutters.php
add an item to the cart with any color choice and the color info does not carry to the cart. -
how can i best re-write the following query. i want to re-write the following sql into something more readable and less line if possible. how can i re-write it
SELECT z.as_cd, z.sass, z.elem_desc
FROM
SELECT a.as_cd, a.sass b.elem_desc
FROM
SELECT DISTINCT as_cd,NVL (as_sub_cd, as_cd) AS sass
FROM b2c
WHERE bdate = p_date
) a,
SELECT /*+ no_merge*/ DISTINCT elem, elem_desc
FROM desc
WHERE ename = 'Class'
) b
WHERE a.as_cd IS NOT NULL
AND a.as_cd = b.elem(+)
) z,
SELECT DISTINCT elem, elem_desc
FROM desc
WHERE ename = 'Sub Class'
) t
WHERE z.sass = t.elem(+)Try this:
SELECT DISTINCT z.as_cd, z.sass, z.elem_desc
FROM desc t,
(SELECT DISTINCT a.as_cd, NVL (a.as_sub_cd, a.as_cd) sass, b.elem_desc
FROM b2c a, desc b
WHERE a.as_cd IS NOT NULL
AND a.as_cd = b.elem(+)
AND b.ename = 'Class'
AND a.bdate = p_date) z
WHERE z.sass = t.elem(+)
AND t.ename = 'Sub Class'; -
How can i achive this result by writing SQL Query ?
Dear Exparts,
Here is my banner
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
"CORE 10.2.0.3.0 Production"
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - ProductionI have two table with relation. Here is the scripts of create table and insert data.
TABLE
CREATE TABLE TAB1
T1_ID NUMBER(5)
, T1_NAME VARCHAR2(100)
ALTER TABLE TAB1
MODIFY (T1_ID NOT NULL);
ALTER TABLE TAB1
ADD CONSTRAINT TAB1_PK PRIMARY KEY
T1_ID
ENABLE;
CREATE TABLE TAB2
T2_ID NUMBER(5) NOT NULL
, T2_T1_ID NUMBER(5)
, T2_RV_NO VARCHAR2(20)
, T2_RV_DATE DATE
, T2_F1 VARCHAR2(20)
, T2_F2 VARCHAR2(20)
, T2_F3 VARCHAR2(20)
, CONSTRAINT TAB2_PK PRIMARY KEY
T2_ID
ENABLE
ALTER TABLE TAB2
ADD CONSTRAINT TAB2_TAB1_FK1 FOREIGN KEY
T2_T1_ID
REFERENCES TAB1
T1_ID
ENABLE;INSERT DATA
Insert into TAB1 (T1_ID,T1_NAME) values (1,'Test 1');
Insert into TAB1 (T1_ID,T1_NAME) values (2,'Test 2');
Insert into TAB2 (T2_ID,T2_T1_ID,T2_RV_NO,T2_RV_DATE,T2_F1,T2_F2,T2_F3) values (1,1,'00',to_date('01-OCT-2012','DD-MON-RRRR'),'Probation','05','Yes');
Insert into TAB2 (T2_ID,T2_T1_ID,T2_RV_NO,T2_RV_DATE,T2_F1,T2_F2,T2_F3) values (2,1,'01',to_date('06-OCT-2012','DD-MON-RRRR'),'Confirm','06','Yes');
Insert into TAB2 (T2_ID,T2_T1_ID,T2_RV_NO,T2_RV_DATE,T2_F1,T2_F2,T2_F3) values (3,2,'00',to_date('02-OCT-2012','DD-MON-RRRR'),'Probation','07','No');
Insert into TAB2 (T2_ID,T2_T1_ID,T2_RV_NO,T2_RV_DATE,T2_F1,T2_F2,T2_F3) values (4,2,'01',to_date('09-OCT-2012','DD-MON-RRRR'),'Probation','07','Yes');
Insert into TAB2 (T2_ID,T2_T1_ID,T2_RV_NO,T2_RV_DATE,T2_F1,T2_F2,T2_F3) values (5,1,'02',to_date('10-OCT-2012','DD-MON-RRRR'),'Confirm','06','No');Now i want to produce the following reports..
Period: 06-OCT-2012 to 09-OCT-2012
T2_RV_DATE T1_NAME T2_RV_NO Revised_Column Previous_Value Revised_value
06-OCT-2012 Test 1 01 T2_F1 Probation Confirm
T2_F2 05 06
09-OCT-2012 Test 2 01 T2_F3 No YesI just achieve Revised_Column Previous_Value Revised_value for a particular name.
Here is my code
SELECT T2_RV_NO,T2_RV_DATE,T1_NAME,'T2_F1' Revised_Column,PREVIOUS_VALUE,REVISED_VALUE
FROM(
SELECT T2_RV_NO,T2_RV_DATE,T1_NAME,'T2_F1',
LAG(T2_F1) OVER (ORDER BY T2_RV_DATE) PREVIOUS_VALUE ,T2_F1 REVISED_VALUE
FROM TAB2,TAB1
WHERE TAB1.T1_ID=TAB2.T2_T1_ID
AND TAB1.T1_ID=:EMP_ID)
WHERE NVL(PREVIOUS_VALUE,'null')<>NVL(REVISED_VALUE,'null')
AND T2_RV_DATE BETWEEN :BEGIN_DATE AND :END_DATE
AND T2_RV_NO<>'00'
UNION ALL
SELECT T2_RV_NO,T2_RV_DATE,T1_NAME,'T2_F2' Revised_Column,PREVIOUS_VALUE,REVISED_VALUE
FROM(
SELECT T2_RV_NO,T2_RV_DATE,T1_NAME,'T2_F2',
LAG(T2_F2) OVER (ORDER BY T2_RV_DATE) PREVIOUS_VALUE ,T2_F2 REVISED_VALUE
FROM TAB2,TAB1
WHERE TAB1.T1_ID=TAB2.T2_T1_ID
AND TAB1.T1_ID=:EMP_ID)
WHERE NVL(PREVIOUS_VALUE,'null')<>NVL(REVISED_VALUE,'null')
AND T2_RV_DATE BETWEEN :BEGIN_DATE AND :END_DATE
AND T2_RV_NO<>'00'
UNION ALL
SELECT T2_RV_NO,T2_RV_DATE,T1_NAME,'T2_F3' Revised_Column,PREVIOUS_VALUE,REVISED_VALUE
FROM(
SELECT T2_RV_NO,T2_RV_DATE,T1_NAME,'T2_F3',
LAG(T2_F3) OVER (ORDER BY T2_RV_DATE) PREVIOUS_VALUE ,T2_F3 REVISED_VALUE
FROM TAB2,TAB1
WHERE TAB1.T1_ID=TAB2.T2_T1_ID
AND TAB1.T1_ID=:EMP_ID)
WHERE NVL(PREVIOUS_VALUE,'null')<>NVL(REVISED_VALUE,'null')
AND T2_RV_DATE BETWEEN :BEGIN_DATE AND :END_DATE
AND T2_RV_NO<>'00'but it's not work for multiple employee id
Thanks in advance
Edited by: Asked to Learn on Oct 6, 2012 9:18 PMAsked to Learn wrote:
thanks members. i get a solution of my own for my reporting purpos. Thanks..Well why don't you post your solution? Why not be helpful to others like yourself who might search the forum looking for answers? Don't just take, give back.
Cheers, APC
Maybe you are looking for
-
Spry menu response time problems with IE
We implemented the spry vertical menu for showing the categories of a products catalog. It has almost 1400 categories organizad at about 5 levels, some categories have about 20 subcategories. These categories are in a coldfusion session variable. It
-
IMac still broken after 10.5.7 problems and Erase and Install
I had written the following at the end of a "solved" post when it was suggested that I start a new post instead. So here is what I had... Ok. I think my iMac was turned into a giant paper weight by 10.5.7. Here's what happened with the Archive and In
-
All, I have a white imac and have recently bought a receiver and 5.1 speakers to go with it. I have connected up amp to PS3 through optical cable and it works fine, but I am hoping to connect my mac straight up to the receiver through the optical out
-
Hi folks I may be becoming a "reverse switcher", from Mac to Windows in the not too distant future [we don't buy "Made in China" products, and Macs are now "Made in China", so replacement is going to have to be to a PC :(] In Mac I edit in Final Cut
-
I successfully downloaded iTunes. It opened several times, now it shuts down everytime with Data Execution Prevention message. Please help