SQL if/else help
Can somebody help me with a query.
select name, isdefault, display_value from v$parameter
where name in ( 'memory_target' , 'sga_target', 'statistics_level') order by name;
If memory_target is set non-zero, print AMM Else if sga_target is set non-zero
and statistics_level is TYPICAL or ALL, print ASMM.
Thanks to all who answer
Hi,
One way is to pivot the data, like this:
WITH relevant_data AS
SELECT name
, display_value
FROM v$parameter
WHERE name IN ( 'memory_target'
, 'sga_target'
, 'statistics_level'
SELECT CASE
WHEN memory_target != '0'
THEN 'AMM'
WHEN sga_target != '0'
AND statistics_level IN ('ALL', 'TYPICAL')
THEN 'ASMM'
END AS amm_or_asmm
FROM relevant_data
PIVOT ( MIN (display_value)
FOR name IN ( 'memory_target' AS memory_target
, 'sga_target' AS sga_target
, 'statistics_level' AS statistics_level
Similar Messages
-
HTML not working in PL/SQL block..Help me ASAP
declare
l_col VARCHAR2(30) :=to_number(to_char(to_date('01-feb-2011','dd-mon-yyyy'),'dd'));
CURSOR name_cur IS
select name
from od_shift_schedule
where year=2011
and (month)=('Feb')
and decode(l_col,1,"01",2,"02",3,"03",4,"04",5,"05",6,"06",7,
"07",8,"08",9,"09",10,"10",11,"11",12,"12",13,"13",14,"14",15,"15",16,"16",17,"17",18,"18",19,"19",20,"20",
21,"21",22,"22",23,"23",24,"24",25,"25",26,"26",
27,"27",28,"28",29,"29",30,"30",31,"31")='W';
BEGIN
DELETE FROM nam;
commit;
FOR i IN name_cur
LOOP
dbms_output.put_line(i.name);
htp.p('<b>Employee '||i.name||' has been ticked.
</b><br/>');
EXECUTE IMMEDIATE 'insert into nam(name) values('''||i.name||''')';
commit;
END LOOP;
end;Kindly help me with this
If i'm wrong here kindly help me that how can i place a display messageRe: HTML not working in PL/SQL block..Help me ASAP
Using the community discussion forums for urgent issues is rude and a violation of the terms and conditions.
http://www.oracle.com/html/terms.html
>
4. Use of Community Services
Community Services are provided as a convenience to users and Oracle is not obligated to provide any technical support for, or participate in, Community Services. While Community Services may include information regarding Oracle products and services, including information from Oracle employees, they are not an official customer support channel for Oracle.
You may use Community Services subject to the following: (a) Community Services may be used solely for your personal, informational, noncommercial purposes; (b) Content provided on or through Community Services may not be redistributed; and (c) personal data about other users may not be stored or collected except where expressly authorized by Oracle
>
Also please read the FAQ on how to ask questions.
SQL and PL/SQL FAQ
>
2) Thread Subject line
Give your thread a meaningful subject, not just "help please", "Query help" or "SQL". This is the SQL and PL/SQL forum. We know your question is going to be about those things, make it meaningful to the type of question so that people with the right sort of knowledge can pick it up and those without can ignore it. Never, EVER, mark your subject as "URGENT" or "ASAP"; this forum is manned by volunteers giving their own time to help and your question is never urgent or more important than their own work or than other people's questions. It may be urgent to you, but that's not forum members issue. -
SQL experts please help for a query
I have following table1.
What query can give the result as given below, SQL experts please help on this.
TABLE1
Event DATETIME
in 2/JAN/2010
out 2/JAN/2010
in 13/JAN/2010
out 13/JAN/2010
in 5/JAN/2010
out 5/JAN/2010
RESULT REQUIRED FROM THE SQL QUERY
COL1_IN COL2_OUT
2/JAN/2010 2/JAN/2010
13/JAN/2010 13/JAN/2010
5/JAN/2010 5/JAN/2010I tried to help, but this puzzles me.
Why is this not returning pre-selected set of rows, why it's doing some merge join cartezian ?
SQL> select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
SQL> select * from table1;
EVENT DATETIME
in 2/JAN/2010
out 2/JAN/2010
in 13/JAN/2010
out 13/JAN/2010
in 5/JAN/2010
out 5/JAN/2010
6 rows selected.
SQL> explain plan for
2 with a as
(select datetime from table1 where event='in'),
b as
(select datetime from table1 where event='out')
select a.datetime COL1_IN ,b.datetime COL2_OUT from a,b ;
Explained.
SQL> set wrap off
SQL> set linesize 200
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 185132177
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 9 | 288 | 8 (0)| 00:00:01 |
| 1 | MERGE JOIN CARTESIAN| | 9 | 288 | 8 (0)| 00:00:01 |
|* 2 | TABLE ACCESS FULL | TABLE1 | 3 | 48 | 3 (0)| 00:00:01 |
| 3 | BUFFER SORT | | 3 | 48 | 5 (0)| 00:00:01 |
|* 4 | TABLE ACCESS FULL | TABLE1 | 3 | 48 | 2 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
Predicate Information (identified by operation id):
2 - filter("EVENT"='in')
4 - filter("EVENT"='out')
Note
- dynamic sampling used for this statement
21 rows selected.
SQL> with a as
(select datetime from table1 where event='in'),
b as
(select datetime from table1 where event='out')
select a.datetime COL1_IN ,b.datetime COL2_OUT from a,b ;
COL1_IN COL2_OUT
2/JAN/2010 2/JAN/2010
2/JAN/2010 13/JAN/2010
2/JAN/2010 5/JAN/2010
13/JAN/2010 2/JAN/2010
13/JAN/2010 13/JAN/2010
13/JAN/2010 5/JAN/2010
5/JAN/2010 2/JAN/2010
5/JAN/2010 13/JAN/2010
5/JAN/2010 5/JAN/2010
9 rows selected.
SQL> -
Cluster bar chart- sql query please help-
Hi,
I am trying to create cluster bar chart and am stumped with this sql query.Any help is appreciated.
Here is my table
city region issue value
c1 north i1 y
c1 north i2 y
c2 north i1 n
c2 north i2 y
c3 south i1 y
c3 south i2 n
c4 east i1 n
c4 east i2 n
The bar chart will have 3 series, north south and east.
And labels will be i1 and i2. value will be number of times this issue was encountered(y) in this region.
How can I get something like this from the above table-
region issue count(yes)
north i1 1
north i2 2
south i1 1
south i2 0
east i1 0
east i2 0
thanksWITH table1 AS
(SELECT 1435177 qte_id, 2 seq_no
FROM dual
UNION ALL
SELECT 1435177 qte_id, 5 seq_no
FROM dual
UNION ALL
SELECT 1435177 qte_id, 7 seq_no
FROM dual
UNION ALL
SELECT 1435177 qte_id, 8 seq_no
FROM dual
UNION ALL
SELECT 1435177 qte_id, 12 seq_no
FROM dual
UNION ALL
SELECT 1435177 qte_id, 14 seq_no
FROM dual
table2 AS
SELECT 1435177 qte_id, 1 seq_no, 98500 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 2 seq_no, 98500 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 3 seq_no, 0 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 4 seq_no, 98500 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 5 seq_no, 98500 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 7 seq_no, 98500 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 8 seq_no, 98500 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 11 seq_no, 59300 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 12 seq_no, 59300 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 14 seq_no, 59300 cmmt_curr_amt
FROM dual
SELECT qte_id, t2_seq_no, cmmt_curr_amt - cmmt_curr_lag diff
FROM
(SELECT t2.qte_id, t2.seq_no t2_seq_no, t1.seq_no t1_seq_no, cmmt_curr_amt, LAG(cmmt_curr_amt,1,0) OVER (PARTITION BY t2.qte_id ORDER BY t2.seq_no) cmmt_curr_lag
FROM table1 t1, table2 t2
WHERE t2.qte_id = t1.qte_id (+)
AND t2.seq_no = t1.seq_no(+)
ORDER BY 1,2
WHERE t1_seq_no IS NOT NULL
ORDER BY 1,2
QTE_ID T2_SEQ_NO DIFF
1435177 2 0
1435177 5 0
1435177 7 0
1435177 8 0
1435177 12 0
1435177 14 0 -
SQL*PLUS 에서 ONLINE HELP 기능
제품 : SQL*PLUS
작성날짜 : 1999-10-08
SQL*PLUS Help
=============
SQL*PLUS 에서 Online Help 기능을 제공하여 굳이 SQL Reference 를 참조하지
않아도 Online 상에서 확인이 가능하다.
그런데 간혹 help 에 문제가 생기는 경우 다음과 같이 새로 생성하면 된다.
1. help 디렉토리로 이동한다.
% cd $ORACLE_HOME/sqlplus/admin/help
2. SYSTEM user 로 SQL*Plus 에 Login 한다.
% sqlplus system/<password>
3. 해당 디렉토리의 "helptbl.sql" script 를 수행한다.
SQL> @helptbl
해당 스크립트는 Help 라는 테이블을 생성하고 Public 으로 지정한다.
4. SQL*Loader 로 필요한 Record 를 Help 테이블에 로딩한다..
% sqlldr system/manager control=plushelp.ctl
% sqlldr system/manager control=sqlhelp.ctl
% sqlldr system/manager control=plshelp.ctl
5. SYSTEM user 로 SQL*Plus 에 Login 한다.
"helpindx.sql" script 를 수행한다.
SQL> @helpindx
해당 스크립트는 필요한 각종 view 와 index 를 생성한다.
// 위의 사항은 Unix 계열의 SQL*PLUS 에서 적용이 되는 내용이다
Windows 95/98/NT 에서는 현재 On-line Help 가 지원되지 않는다.
다만 Oracle install CD 에서 Oracle Online Documentation 을 인스톨 한
후 Adobe Acrobat runtime 으로 보아야 한다.
DB SERVER 8.1.6 이상에서는
SQLPLUS에서 사용되는 help 기능만 제공됩니다.
8.1.6 이상에서 help를 생성하기 위해서는
% cd $ORACLE_HOME/sqlplus/admin/help
% sqlplus system/<password>
SQLPLUS>helpbld.sql
SQLPLUS>helpus.sqlI personally don't like SQL Developer or TOAD, though perhaps I'm in a minority. I agree completely. Toad does a lot of things but many of are ill thought out, the most obvious is the default feature of displaying a result time after fetching the first screen of rows. This alone has led to hundreds of posting along the lines of, I have this query that returns 12 billion rows. In a stored procedure it takes days, but it completes in 12 milliseconds in TOAD?
The last I looked SQL Developer had that typical Java sluggishness on a Windows box, and I am still not interested in whether that is a Windows or Java problem. I just know that if I have to use Windows I tend to choose applications that are not written in Java if possible.
It also was unable to connect using OS authenticated accounts which effectively ruled it out as anything other than a toy as our development environment mandates it. I believe there may be a workaround, but there are always hints of waving a rubber chicken at it and frankly why bother at this stage.
PL/SQL Developer is by far the best. -
ORA-01458 error while using Pro*C to invoke PL/SQL procedure, pls help
I am using Pro*C (Oracle 10g on Itanium platform) to invoke PL/SQL procedure to read RAW data from database, but always encoutered ORA-01458 error message.
Here is the snippet of Pro*C code:
typedef struct dataSegment
unsigned short len;
unsigned char data[SIZE_DATA_SEG];
} msg_data_seg;
EXEC SQL TYPE msg_data_seg IS VARRAW(SIZE_DATA_SEG);
EXEC SQL BEGIN DECLARE SECTION;
unsigned short qID;
int rMode;
unsigned long rawMsgID;
unsigned long msgID;
unsigned short msgType;
unsigned short msgPriority;
char recvTime[SIZE_TIME_STRING];
char schedTime[SIZE_TIME_STRING];
msg_data_seg dataSeg;
msg_data_seg dataSeg1;
msg_data_seg dataSeg2;
short indSeg;
short indSeg1;
short indSeg2;
EXEC SQL END DECLARE SECTION;
qID = q_id;
rMode = (int)mode;
EXEC SQL EXECUTE
BEGIN
SUMsg.read_msg (:qID, :rMode, :rawMsgID, :msgID, :msgType, :msgPriority, :recvTime,
:schedTime, :dataSeg:indSeg, :dataSeg1:indSeg1, :dataSeg2:indSeg2);
END;
END-EXEC;
// Check PL/SQL execute result, different from SQL
// Only 'sqlcode' and 'sqlerrm' are always set
if (sqlca.sqlcode != 0)
if (sqlca.sqlcode == ERR_QUEUE_EMPTY) // Queue empty
throw q_eoq ();
char msg[513]; // Other errors
size_t msg_len;
msg_len = sqlca.sqlerrm.sqlerrml;
strncpy (msg, sqlca.sqlerrm.sqlerrmc, msg_len);
msg[msg_len] = '\0';
throw db_error (string(msg), sqlca.sqlcode);
and here is the PL/SQL which is invoked:
SUBTYPE VarChar14 IS VARCHAR2(14);
PROCEDURE read_msg (
qID IN sumsg_queue_def.q_id%TYPE,
rMode IN INTEGER,
raw_msgID OUT sumsg_msg_data.raw_msg_id%TYPE,
msgID OUT sumsg_msg_data.msg_id%TYPE,
msgType OUT sumsg_msg_data.type%TYPE,
msgPrior OUT sumsg_msg_data.priority%TYPE,
msgRecv OUT VarChar14,
msgSched OUT VarChar14,
msgData OUT sumsg_msg_data.msg_data%TYPE,
msgData1 OUT sumsg_msg_data.msg_data1%TYPE,
msgData2 OUT sumsg_msg_data.msg_data2%TYPE
) IS
BEGIN
IF rMode = 0 THEN
SELECT raw_msg_id, msg_id, type, priority, TO_CHAR(recv_time, 'YYYYMMDDHH24MISS'),
TO_CHAR(sched_time, 'YYYYMMDDHH24MISS'), msg_data, msg_data1, msg_data2
INTO raw_msgID, msgID, msgType, msgPrior, msgRecv, msgSched, msgData, msgData1, msgData2
FROM (SELECT * FROM sumsg_msg_data WHERE q_id = qID AND status = 0 ORDER BY sched_time, raw_msg_id)
WHERE ROWNUM = 1;
ELSIF rMode = 1 THEN
SELECT raw_msg_id, msg_id, type, priority, TO_CHAR(recv_time, 'YYYYMMDDHH24MISS'),
TO_CHAR(sched_time, 'YYYYMMDDHH24MISS'), msg_data, msg_data1, msg_data2
INTO raw_msgID, msgID, msgType, msgPrior, msgRecv, msgSched, msgData, msgData1, msgData2
FROM (SELECT * FROM sumsg_msg_data WHERE q_id = qID AND status = 0 ORDER BY recv_time, raw_msg_id)
WHERE ROWNUM = 1;
ELSE
SELECT raw_msg_id, msg_id, type, priority, TO_CHAR(recv_time, 'YYYYMMDDHH24MISS'),
TO_CHAR(sched_time, 'YYYYMMDDHH24MISS'), msg_data, msg_data1, msg_data2
INTO raw_msgID, msgID, msgType, msgPrior, msgRecv, msgSched, msgData, msgData1, msgData2
FROM (SELECT * FROM sumsg_msg_data WHERE q_id = qID AND status = 0 ORDER BY priority, raw_msg_id)
WHERE ROWNUM = 1;
END IF;
UPDATE sumsg_msg_data SET status = 1 WHERE raw_msg_id = raw_msgID;
EXCEPTION
WHEN NO_DATA_FOUND THEN
raise_application_error (-20102, 'Queue empty');
END read_msg;
where sumsg_msg_data.msg_data%TYPE, sumsg_msg_data.msg_data1%TYPE and sumsg_msg_data.msg_data2%TYPE are all defined as RAW(2000). When I test the PL/SQL code seperately, everything is ok, but if I use the Pro*C code to read, the ORA-01458 always happen, unless I change the SIZE_DATA_SEG value to 4000, then it passes, and the result read out also seems ok, either the bigger or smaller value will encounter ORA-01458.
I think the problem should happen between the mapping from internal datatype to external VARRAW type, but cannot understand why 4000 bytes buffer will be ok, is it related to some NLS_LANG settings, anyone can help me to resolve this problme, thanks a lot!It seems that I found the way to avoid this error. Now each time before I read RAW(2000) data from database, i initialize the VARRAW.len first, set its value to SIZE_DATA_SEG, i.e., the outside buffer size, then the error disappear.
Oracle seems to need this information to handle its data mapping, but why output variable also needs this initialization, cannot precompiler get this from the definition of VARRAW structure?
Anyone have some suggestion? -
Oracle SQL Developer Installation Help (Basics?)
Hello
So im taking a class (student here, totally new to this) in Oracle SQL right now and trying to download the Oracle SQL Developer tool onto my desktop (v 2.1.1).
Im just starting up Oracle SQL Developer and its asking, or I am looking to create a connection.
I was wondering if anyone had a tutorial for how to make a connection?
I only have Oracle SQL developer installed on my machine right now, nothing else. I dont have a server or anything, and just wanted to run this on my desktop local machine to practice running some SQL.
Is there anything else i need to install?
Is there some basic username and password that would allow me to connect to my local machine?
What values do i need for the hostname, port and SID etc?
Any help for a new student to Oracle would be greatly appreciated.You'd need a database to connect the SQL Developer client to.
The easiest / quickest if you're a student would be the Express Edition.
http://www.oracle.com/technetwork/database/express-edition/downloads/index.html
Pick your platform and away you go.
Your hostname will then be 127.0.0.1, SID will be XE .... username and password will depend on what you choose when you're installing (you should get prompted for SYS/SYSTEM passwords). -
Sql-loader error, help!!!!
Recently I found the following error message in the sql-loader log file.
ora-704 , I can't find corresponding explainatino in oracle documentation. I use sql-loader 7.3 to load .dat file extracted from our ERP system. This error can't be monitored by pl/sql and quite dangerous . Please kindly help me to solve this problem.Many thanks!!The ora-704 error message is pretty serious. It's a boot-strap kind of message that you usually get on db startup when something is seriously wrong. What version of db are you running? If it's pre-8.0 then you might check to see if the sys.bootstrap$ table was set to unlimited extents (one of those weird issue things). Although I wouldn't suggest modifying the sys schema's objects to set the extents to something other than unlimited, this might open some doors into something else.
If you're truly getting this:
ORA-00704: "bootstrap process failure"
Cause: Failure in processing bootstrap data - see accompanying
error.
Action: Contact your customer support representative.
Then you really need to contact a CSR for technical help that is supported by Oracle itself.
Good luck
EC -
Hi All,
I have a table that has 2 columns X, and Y.
create table temp(
x number(5);
y number (5);
);I am trying to write a query to check both columns, here is what I mean.
SELECT CASE
IF X = 1 AND Y = 0 THEN 3
IF X = 2 AND Y = 1 THEN 4
IF X = 4 AND Y IS NULL THEN 5
END AS STATUS
FROM .....temp ...etc.I know what I want but having problems with the syntax.
Thanks in Advance for your help.
I'm using Oracle 11g, SQL Dev 3.0select case when x = 1 and y = 0 then 3
when x = 2 and y = 1 then 4
when x = 4 and y is null then 5
else null
end ans
from ...for more on the case syntax see either one of these links.
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/case_statement.htm
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/expressions004.htm -
oracle 10g.
os : linux
table data appears like this
SQL> select * from test_grp;
COL1 COL2
aaa 111
aaa 444
aaa 222
bbb 333
bbb 555
SQL> select * from test_grp order by 2;
COL1 COL2
aaa 111
aaa 222
bbb 333
aaa 444
bbb 555
As per my application requirement I need to seggerage the data as
follows
aaa (2) ie --- 111,222
bbb(1) is --- 333
aaa(1) is --- 444
bbb(1) is -- 555
I am not able to frame this. Any help ?SQL> create table test_grp
2 as
3 select 'aaa' col1, 111 col2 from dual union all
4 select 'aaa', 444 from dual union all
5 select 'aaa', 222 from dual union all
6 select 'bbb', 333 from dual union all
7 select 'bbb', 555 from dual
8 /
Tabel is aangemaakt.
SQL> select col1
2 , col2s
3 from ( select col1
4 , rtrim(col2s,',') col2s
5 , rn
6 , sumn
7 from ( select col1
8 , col2
9 , sum(n) over (order by col2) sumn
10 from ( select col1
11 , col2
12 , case when col1 = lag(col1) over (order by col2) then 0 else 1 end n
13 from test_grp
14 ) t
15 )
16 model
17 partition by (sumn)
18 dimension by (row_number() over (partition by sumn order by col2) rn)
19 measures (col1, cast(col2 as varchar2(100)) col2s)
20 rules
21 ( col2s[any] order by rn desc = col2s[cv()] || ',' || col2s[cv()+1]
22 )
23 )
24 where rn = 1
25 order by sumn
26 /
COL COL2S
aaa 111,222
bbb 333
aaa 444
bbb 555
4 rijen zijn geselecteerd.Regards,
Rob. -
I want to submit a concurrent program from pl/sql. Please help me.
Dear all,
I want to submit a concurrent program from pl/sql. But I failed. Please help me.
Detail:
I create a concurrent program in 'Cash Management, Vision Operations (USA)' responsibility. <strong>And it be submitted success in EBS</strong>.
Then
I create a test script in pl/sql. And use 'FND_GLOBAL.APPS_INITIALIZE' to initialize ebs, then use 'FND_REQUEST.SUBMIT_REQUEST' to submit
the consurrent program, But the procedure aways return <strong>0</strong>.
I cannot found the reason. Please help me.Thanks.
<em>Attached informations may describe the problem:
1.The concurrenct submitted success in EBS.</em>
request_id = 4750655 (Sorry, I dont know how to add pictures.)
<em>2.The initialize informations which from SQL</em>.
SELECT FCR.REQUESTED_BY USER_ID
,FCR.RESPONSIBILITY_ID
,FCR.RESPONSIBILITY_APPLICATION_ID
,FA.APPLICATION_SHORT_NAME
,FCP.CONCURRENT_PROGRAM_NAME
FROM FND_CONCURRENT_REQUESTS FCR
,FND_APPLICATION FA
,FND_CONCURRENT_PROGRAMS FCP
WHERE FCR.PROGRAM_APPLICATION_ID = FA.APPLICATION_ID
AND FCR.CONCURRENT_PROGRAM_ID = FCP.CONCURRENT_PROGRAM_ID
AND FCR.REQUEST_ID = 4750655;
Result: user_id = 1318;
responsibility_id = 50579;
application_id = 260;
application_short_name = 'CE';
program_short_name = 'CALLK009';
<em>3.The test script code.</em>
<p>
-- Created on 2008/10/22 by ERIC
declare
-- Local variables here
Wv_conc_req_id VARCHAR2(10) DEFAULT NULL;
BEGIN
FND_GLOBAL.APPS_INITIALIZE(
1318
,50579
,260
Wv_conc_req_id := FND_REQUEST.SUBMIT_REQUEST(
'CE'
,'CALLK009'
,NULL
,SYSDATE
,FALSE
, CHR(0), CHR(0), CHR(0), CHR(0), CHR(0)
, CHR(0), CHR(0), CHR(0), CHR(0), CHR(0)
, CHR(0), CHR(0), CHR(0), CHR(0), CHR(0)
, CHR(0), CHR(0), CHR(0), CHR(0), CHR(0)
, CHR(0), CHR(0), CHR(0), CHR(0), CHR(0)
, CHR(0), CHR(0), CHR(0), CHR(0), CHR(0)
, CHR(0), CHR(0), CHR(0), CHR(0), CHR(0)
, CHR(0), CHR(0), CHR(0), CHR(0), CHR(0)
, CHR(0), CHR(0), CHR(0), CHR(0), CHR(0)
, CHR(0), CHR(0), CHR(0), CHR(0), CHR(0)
, CHR(0), CHR(0), CHR(0), CHR(0), CHR(0)
, CHR(0), CHR(0), CHR(0), CHR(0), CHR(0)
, CHR(0), CHR(0), CHR(0), CHR(0), CHR(0)
, CHR(0), CHR(0), CHR(0), CHR(0), CHR(0)
, CHR(0), CHR(0), CHR(0), CHR(0), CHR(0)
, CHR(0), CHR(0), CHR(0), CHR(0), CHR(0)
, CHR(0), CHR(0), CHR(0), CHR(0), CHR(0)
, CHR(0), CHR(0), CHR(0), CHR(0), CHR(0)
, CHR(0), CHR(0), CHR(0), CHR(0), CHR(0)
, CHR(0), CHR(0), CHR(0), CHR(0), CHR(0)
DBMS_OUTPUT.PUT_LINE(Wv_conc_req_id);
COMMIT;
end;
<em>4.The concurrent program code.</em>
create or replace package body CALLTEST is
PROCEDURE T1(PvO_errbuf OUT VARCHAR2
,PvO_retcode OUT VARCHAR2)
IS
BEGIN
FND_FILE.PUT_LINE(fnd_file.log, 'TEST');
END;
end CALLTEST;
</p>Can you check from which schema you are executing FND_REQUEST? You can try as follows;
Connect to your required schema, create a synonym on apps.fnd_request, connect from apps and finally execute grant all on apps.fnd_request to all.
You can check for relevance from Doc ID: Note:147495.1
Please do keep in the mind the soultion above should be applied to a test/dev EBS instance first.
I hope this would be of help.
Saad -
Database connection to MS SQL 2005 (URGENT Help Needed)
Hi all,
Does anyone know how to connect my adobe form to MS SQL 2005?
I have this code:
try {
InitialContext initialContext = new InitialContext ();
DataSource dataSource = (DataSource) initialContext.lookup ("jdbc/MyAlias");
java.sql.Connection connection = dataSource.getConnection ();
} catch (SQLException e) {
// handle exception
} catch (NamingException e) {
// handle exception
Other than these, what else do i need to do inorder to get my database connection up?
And after my database connection is up, how do i test to check if my database connection is up or not?
How do i extract the information from the database and put them onto the textfields/dropdownlists on my form?
Thanks In AdvanceHi Mel,
After implementing the codes and modifying them, some of them are underlined, why is this so? =X
Or are u willing to exchange msn so i could send u the screenshot instead?
Thanks In Advance
(Sorry im not that good in this)
(I shall underline the areas which represents the red underline in my web dynpro)
//Code for database connection.
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource)_ctx.lookup("jdbc/JXDataSource");_
Connection conn = ds.getConnection();
Statement st = null;
ResultSet rs = null;
IPrivateDetailed_Claims_FormView.IFillDataElement dataEle = null;
st = conn.createStatement();
// Execute the appropriate SQL query
rs = st.executeQuery("SELECT NAME WHERE VENDORCODE='9000116L' ");_
while (rs.next()) {
// Code that will populate your VN based on the data obtained in the ResultSet.
dataEle = wdContext.createFillDataElement();
dataEle.setName(_rs.getString(1)_);
// dataEle.setAge(rs.getInt(2));
// dataEle.setAddress(rs.getString(3));
//wdContext.nodeFillData.addElement(dataEle);
// Close the connections
rs.close();
st.close();
conn.close();
Edited by: JingXuan Lim on Jan 25, 2008 4:59 AM
Edited by: JingXuan Lim on Jan 25, 2008 5:00 AM -
New to pl/sql and need help with procedure
Hello there, I got two tables STAFF and BONUS which are not related by any constraints
STAFF
ID_NUMBER HIREDATE SALARY BONUS
100020 12-MAY-03 13600
100021 04-NOV-01 30000
100022 08-APR-02 28000
100023 08-APR-02 24000
BONUS
PERCENTAGE MORE_THAN_YEARS
0.1 3
0.15 5
0.3 7
0.45 9
0.5 12
I am trying to create a procedure that would calculate bonus based on years of employment according to bonus table.
If employees sysdate -hiredate is greater than 5, he would get salary*0.15%....
I created this procedure, but I got stuck here.
I calculated the length of employment for every soldier using cursor in a loop, but I don't know how to get values from bonus table and connect them together.
Please help me!
create or replace
procedure bonus_staff
as
cursor c1 is select *from staff;
bon real;
begin
FOR ITEM IN C1
LOOP
bon := FLOOR(months_BETWEEN(SYSDATE,ITEM.hiredate)/12)*
update staff
set bonus = bon
where id_number = ITEM.id_number;
exit when c1%notfound;
end loop;
end;
Thanks in advance..update staff
set bonus = (select percentage
from bonus
where more_than_years = (select max(more_than_years)
from bonus
where more_than_years <= FLOOR(months_BETWEEN(SYSDATE,staff.hiredate)/12)
You can do this in pure SQL, which operates on a set, so no PL/SQL is required.
Sybrand Bakker
Senior Oracle DBA -
SQL Case statement Help....
Hi , I have to Compare two columns to see if they are matching or not....and give the count() of overrides if they are not matching/
I have got that with the below SQL:
Count of Overrides =
select count(Case when Col_1 != Col_2 then 1 else null end) Overrides
from table_1, table_2
where table_1.id = table_2.id
But now i have to look at two columns and get the count()
I have
col_1 and col_2 in table_1 and
col_3 and col_4 in table_2
(I have to compare col_1 with col_2 and...... col_3 with col_4 and if either of them is not matching.... count it as an override
Will the following SQL return correct values?
Count of Overrides =
Select
Count( Case when (col_1 ! = col_2) or (col_3 != col_4) then 1 else null end) Overrides
from table_1, table_2
where table_1.id = table_2.id
Thanks"yes, it can be rewritten as a decode. but why bother?"
Well, although I do like Sy's code better, the decode version does naturally handle NULLs unlike the case.
SQL> WITH t AS (
2 SELECT 1 col_1, 1 col_2, 2 col_3, 2 col_4 FROM dual UNION ALL
3 SELECT 1, 1, 2, 3 FROM dual UNION ALL
4 SELECT 1, 2, 3, 3 FROM dual UNION ALL
5 SELECT null, 1, 2, 2 FROM dual UNION ALL
6 SELECT 1, 1, 2, null FROM dual UNION ALL
7 SELECT 1, 2, 3, 4 FROM dual)
8 SELECT col_1, col_2, col_3, col_4,
9 CASE WHEN (col_1 ! = col_2) or (col_3 != col_4) then 1 else null end Ocase,
10 DECODE(col_1, col_2, DECODE(col_3, col_4, NULL, 1), 1) odecode
11 FROM t;
COL_1 COL_2 COL_3 COL_4 OCASE O
1 1 2 2
1 1 2 3 1 1
1 2 3 3 1 1
1 2 2 1
1 1 2 1
1 2 3 4 1 1John -
In trying to help another user, I was reminded of a problem I
face
often. Trying to create a DW recordset using an IN clause (I
think this
got broken in the 8.0.2 update and seems to still be broken
in CS3).
I create a string held in a variable like this:
$ids = (1,5,9,23,6)
My advanced recordset is this:
SELECT * FROM tbl WHERE id IN varIds
Then I set the variable parameters to type=text,
default=(-1), and
runtime to $ids.
The generated SQL doesn;t work because DW puts single quotes
around my
variable and the SQL query becomes invalid. DW creates this:
SELECT * FROM tbl WHERE id IN '(1,5,9,23,6)'
It should be:
SELECT * FROM tbl WHERE id IN (1,5,9,23,6)
So, I edited the SWITCH block at the top of the document to
include a
"custom" type, which is the same as the TEXT type but without
the single
quotes.
case "custom":
$theValue = ($theValue != "") ? $theValue : "NULL";
break;
Then in my SQL statement, I manually changed "text" to
"custom".
This work fine, but does that open me up to SQL injection or
other bad
stuff?
Alec Fehl, MCSE, A+, ACE, ACI
Adobe Community Expert
AUTHOR:
Microsoft Office 2007 PowerPoint: Comprehensive Course
(Labyrinth
Publications)
Welcome to Web Design and HTML (Labyrinth Publications)
CO-AUTHOR:
Microsoft Office 2007: Essentials (Labyrinth Publications)
Computer Concepts and Vista (Labyrinth Publications)
Mike Meyers' A+ Guide to Managing and Troubleshooting PCs
(McGraw-Hill)
Internet Systems and Applications (EMC Paradigm)It looks like you're using PHP ... to protect from SQL
injections I always
do this:
$query = "SELECT * FROM tbl WHERE col='%s' AND col2 IN
(%d,%d)"
$query = sprintf($query,"val",34,23);
$result = mysql_query($query);
This method ensures that if a user puts "DELETE FROM tbl" in
an input
field, it will not cause any deletions, instead the words
'DELETE FROM tbl'
will be inserted. Check out sprintf in the PHP manual - good
stuff!
One thing to remember about SQL injection, the injected SQL
has to be
entered somehow by the end-user (usually with a form); I may
be wrong, but
this sql statement looks like it is contained entirely within
your scripts
(i.e. it isn't getting getting a user-generated value to
build any part of
the SQL statement). Again, I'm guessing here - but it looks
that way.
Alex
"Alec Fehl" <[email protected]> wrote in message
news:[email protected]...
> In trying to help another user, I was reminded of a
problem I face often.
> Trying to create a DW recordset using an IN clause (I
think this got
> broken in the 8.0.2 update and seems to still be broken
in CS3).
>
> I create a string held in a variable like this:
> $ids = (1,5,9,23,6)
>
> My advanced recordset is this:
>
> SELECT * FROM tbl WHERE id IN varIds
>
> Then I set the variable parameters to type=text,
default=(-1), and runtime
> to $ids.
>
> The generated SQL doesn;t work because DW puts single
quotes around my
> variable and the SQL query becomes invalid. DW creates
this:
>
> SELECT * FROM tbl WHERE id IN '(1,5,9,23,6)'
>
> It should be:
>
> SELECT * FROM tbl WHERE id IN (1,5,9,23,6)
>
> So, I edited the SWITCH block at the top of the document
to include a
> "custom" type, which is the same as the TEXT type but
without the single
> quotes.
> case "custom":
> $theValue = ($theValue != "") ? $theValue : "NULL";
> break;
> Then in my SQL statement, I manually changed "text" to
"custom".
>
> This work fine, but does that open me up to SQL
injection or other bad
> stuff?
>
>
> --
> Alec Fehl, MCSE, A+, ACE, ACI
> Adobe Community Expert
>
> AUTHOR:
> Microsoft Office 2007 PowerPoint: Comprehensive Course
(Labyrinth
> Publications)
> Welcome to Web Design and HTML (Labyrinth Publications)
>
> CO-AUTHOR:
> Microsoft Office 2007: Essentials (Labyrinth
Publications)
> Computer Concepts and Vista (Labyrinth Publications)
> Mike Meyers' A+ Guide to Managing and Troubleshooting
PCs (McGraw-Hill)
> Internet Systems and Applications (EMC Paradigm)
Maybe you are looking for
-
Hello somebody can help me? I bought a new ipad and I need to transfer all the information, documents, etc.. from my old ipad to the new one how can I do that?
-
FCP 5 Batch capture broken...
I've been fighting with FCP since version 1, so I know it's not a simple case of bad prefs or something, this is a real debilitating problem... HELP!! I'm using a Kona LS and a rented A500 Digi Beta deck and I just upgraded to FCP 5 and now batch cap
-
Data delay in producer consumer loop?
Hi, I've been creating an VI using producer consumer loop. In producer loop, every loop take 1000 samples at the rate of 40000/s(or 40000s/s devided by number of channels) and the consumer loop will average the data in a way corresponding to the "sam
-
Has anyone successfully booted a PowerMac G5 using a Seagate 7200.10? I have a Seagate 320GB 7200.10 and it works fine as a second drive, whether setup a SATA 150 or SATA 300. But it will not boot. I cloned the boot drive to the 7200.10 and it would
-
when ever i download an update i.e,iOS 5.0.1 Software Update it shows an error so pls help me or guide through it.....the error shown is-3676 timed out