SQL for join table problem?
hi morning,
my problem also haven find out the solution,can help me solve.
I got one part of register student to exam,during that part is like that.
Student Code:________(table3)
Exam Code:_________(table 3)
Student Name:________(table 1)
Exam Name:_________(table 2)
I can write code call table 3 but when three table join together in part 3,got problem is come out alry....The problem is inside the Student Name & Exam Name.When i use the button for NEXTRECORD to check record,cannot call the student Name & exam Name.
Thank for help. Because i use sql code to call table 3 to check table1 and table 2 detail ,then retrive that data.
my code is like that,
private void cmd_NexRec_RSEActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int i;
i=0;
try{
String x1,x2;
x1=(jTextField10.getText()).trim();
x2=(jTextField11.getText()).trim();
if (x1.equals("")&& x2.equals("") )
counter.studentExam="R";
counter.registerStudentExam="N";
i++;
jInternalFrame8.setVisible(false);
Connection con = getConnection2();
Statement s = con.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet rs=getStudentExams();
ResultSet rs1=getCodes();
ResultSet rs2=getExams();
String select="select * from studentExamFile a LEFT JOIN {studentData b} ON a.student_code=b.student_code LEFT JOIN {exam c} ON c.exam_code=a.exam_code where student_code='"+ x1 +"' and exam_code='"+ x2 +"'" ;
// String select ="select * from studentExamFile , exam , studentData where studentExamFile.student_code=studentData.student_code and exam.exam_code=studentExamFile.exam_code ";
// rs = s.executeQuery(select);
rs.next();
StudentExam c=getstudentcode(rs);
Code c1=getCode(rs1);
Examcode c2=getexamcode(rs2);
jTextField12.setText(c.studentcode);
jTextField13.setText(c.examcode);
jTextField14.setText(rs.getString("c1.name"));
jTextField15.setText(rs.getString("c2.ename"));
// jTextField14.setText(c1.name);
// jTextField14.setText(c2.ename);
jLabel16.setText("Record: Review");
jInternalFrame10.setVisible(true);
jTextField12.setEnabled(false);
jTextField13.setEnabled(false);
//New Line
jTextField14.requestFocus();
else
Connection con = getConnection2();
Statement s = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
String w=(jTextField10.getText()).trim();
String w2=(jTextField11.getText()).trim();
//String select= "select * from [studentExamFile] where [student_code]>'" w "'";
// String select1="select * from [studentExamFile] where [exam_code]>'" w2 "'";
String select="select * from studentExamFile a LEFT JOIN {studentData b} ON a.student_code=b.student_code LEFT JOIN {exam c} ON c.exam_code=a.exam_code where student_code='"+ x1 +"' and exam_code='"+ x2 +"'" ;
ResultSet rs;
rs = s.executeQuery(select);
// rs = s.executeQuery(select1);
rs.next();
if(rs.isFirst())
counter.registerStudentExam="N";
jInternalFrame8.setVisible(false);
jTextField12.setText(rs.getString(1));
jTextField13.setText(rs.getString(2));
jLabel16.setText("Record: Review");
jInternalFrame10.setVisible(true);
jTextField12.setEnabled(false);
jTextField13.setEnabled(false);
//New Line
jTextField14.requestFocus();
counter.studentExam="R";
else
JOptionPane.showMessageDialog(this,"End of the file ","Infomation",JOptionPane.INFORMATION_MESSAGE);
}catch(SQLException e)
System.out.println("Error");
//jTextField3.requestFocus();
}
thanks for reply.
i think my problem is in connection to database .
String sql="select studentData.student_name, exam.exam_name from studentData,exam,studentExamFile where studentData.student_code=studentExamFile.student_code and exam.exam_code=studentExamFile.exam_code ";
// String sql="select studentData.student_name , exam.exam_name from studentExamFile LEFT JOIN { studentData } ON studentExamFile.student_code=studentData.student_code LEFT JOIN { exam } ON exam.exam_code=studentExamFile.exam_code ";
Connection con = getConnection();
Statement s = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
Connection con2 = getConnection();
Statement s3 = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
System.out.println("error");//my problem inside here....help me
rs3=s.executeQuery(sql);
rs3=s3.executeQuery(sql);
rs3.next();
String s1,s2;
s1=rs3.getString(1);//maybe me dunno how to convert the sql data...
s2=rs3.getString(2);
rs.next();
rs2.next();
// rs3.next();
Code c=getCode(rs);
Examcode c2=getexamcode(rs2);
StudentExam c3=getstudentcode(rs3);
jTextField12.setText(c3.studentcode);
jTextField13.setText(c3.examcode);
// jTextField14.setText(rs.getString("c.name"));
//jTextField15.setText(rs.getString("c2.ename"));
jTextField14.setText(s1);
jTextField15.setText(s2);
jLabel16.setText("Record: Review");
jInternalFrame10.setVisible(true);
jTextField12.setEnabled(false);
//New Line
jTextField14.requestFocus();
Similar Messages
-
hi there..i need ur helps
Here are my tables n column name for each tables
a) rep_arrngt
Name
REP_ARRNGT_ID
REP_ARRNGT_DESC
REP_ARRNGT_TYPE
ACCT_CAT
DEF_INDUSTRY_CODE
MEDIA_ID
LANGUAGE_ID
CURRENCY
PAGE_ID
b) bci_rep_arrng
Name
REP_ARRNGT_ID
BCI
SUB_SUM_CODE
DP_SUB_SUM_CODE
c) acct_rep_arrngt_link
Name
ACCT_NO
REP_ARRNGT_ID
DOC_TYPE
LAST_BILL_DATE
BILL_FREQUENCY
SCALING
EFF_FROM_DATE
EFF_TO_DATE
MEDIA_ID
Actually, i want to get the unique value for sub_sum_code according to the bci..
i already use join tables n here is my sql statement :
SELECT T1.SUB_SUM_CODE,T1.BCI,T1.REP_ARRNGT_ID,T2.REP_ARRNGT_ID,T3.REP_ARRNGT_ID FROM BCI_REP_ARRNG T1, REP_ARRNGT T2, ACCT_REP_ARRNGT_LINK T3 WHERE T1.REP_ARRNGT_ID=T2.REP_ARRNGT_ID AND T2.REP_ARRNGT_ID=T3.REP_ARRNGT_ID AND BCI='TTA00F06'
n my results is :
SUB_SUM_CODE BCI REP_ARRNGT_ID
TBGSR TTA00F06 R1
TBGSR TTA00F06 R1
TBGSR TTA00F06 R1
TBGSR TTA00F06 R1
I get the repeated results for sub_sum_code..
so, what i need to do if i want only 1 row results like this :
[u]SUB_SUM_CODE BCI REP_ARRNGT_ID
TBGSR TTA00F06 R1
i try to use group by, but i get the error..plz help meIf you only want "to get the unique value for sub_sum_code according to the bci" then why are you joining the tables in the first place? Not knowing PKs etc you could just use DISTINCT in your select statement.
SELECT DISTINCT T1.SUB_SUM_CODE,
T1.BCI
FROM BCI_REP_ARRNG T1
AND BCI='TTA00F06' -
Rules for joining tables in SQVI
Hi all,
I'm new to this community and this is my first time when i post on this forum. Hope I didn't post or did anything to bad.
I just want to know how can I know which tables should I join. I'm trying to create a report that shows me all the open items from a GL account (Construction In Progress) and have beside the AUC the AUC description, order, PO, Vendor, vendor name, plant, material (at least).
I tried to join BSIS and ANLA for starters, but anything I select it just gives me the same error "No data was selected" Is there any rule like only the key should be selected as selection fields, anything that you could advise would be a blessing.
Thank you
Edited by: Viorel_Petre on Jan 18, 2011 10:52 AMHi,
Welcome to SDN!!!
Since you are new to SAP.
you should ask the functional consultant to provide you with the names of the tables and fields.
the transaction SQVI is used to create queries and you can also use it to know relation bewetween tables for appplying join conditions.
for join conditions.
1. create VIEW.
2. Choose data source as table join.
3. insert 2 tables so see the realation between them.
search google/SDN for more information. -
SQL query for join table and multiple values
Trying to join two tables , Emphours and EmpStatus to get
result which gives each emplyees hour
worked each day
in past say 1 year in what status. I need result similar to table 3 , Hours Can also be grouped per week
all I need Is Each employees hours in each week and his status and position at that time if possible
any help will be highly appreciated. Thank you
note: payday is every other Friday- week runs from Saturday through Friday
EmpStatus Table tracks when employees status changed
EmpHours
employee
workday
payday
hours
position
101
1/1/2014
1/3/2014
8
assistant
101
1/3/2014
1/3/2014
8
assistant
101
1/4/2014
1/17/2014
8
assistant
101
1/5/2014
1/17/2014
8
assistant
101
1/7/2014
1/17/2014
8
assistant
101
1/8/2014
1/17/2014
8
assistant
101
1/9/2014
1/17/2014
8
assistant
101
1/11/2014
1/17/2014
8
assistant
101
1/13/2014
1/17/2014
8
assistant
101
1/14/2014
1/17/2014
8
assistant
101
1/18/2014
2/14/2014
8
assistant
102
1/1/2014
1/3/2014
7
manager
102
1/25/2014
1/31/2014
7
manager
102
1/26/2014
1/31/2014
7
manager
102
1/28/2014
1/31/2014
7
manager
102
1/31/2014
1/31/2014
7
manager
103
1/1/2014
1/3/2014
5
intern
103
1/31/2014
1/31/2014
6
intern
104
1/14/2014
1/17/2014
5
supervisor
104
1/30/2014
1/31/2014
6
supervisor
EmpStatus
employee
start_date
status
101
1/1/2014
parttime
101
1/18/2014
fulltime
102
1/1/2014
seasonal
102
1/18/2014
fulltime
103
1/1/2014
partime
103
1/18/2014
fulltime
104
1/4/2014
parttime
104
1/18/2014
fulltime
Table 3
employee
status
hours
position
workday
weekend
payday
101
parttime
8
assistant
1/1/2014
1/3/2014
1/3/2014
101
parttime
8
assistant
1/3/2014
1/3/2014
1/3/2014
101
parttime
8
assistant
1/4/2014
1/10/2014
1/17/2014
101
parttime
8
assistant
1/5/2014
1/10/2014
1/17/2014
101
parttime
8
assistant
1/7/2014
1/10/2014
1/17/2014
101
parttime
8
assistant
1/8/2014
1/10/2014
1/17/2014
101
parttime
8
assistant
1/9/2014
1/10/2014
1/17/2014
101
parttime
8
assistant
1/11/2014
1/17/2014
1/17/2014
101
parttime
8
assistant
1/13/2014
1/17/2014
1/17/2014
101
parttime
8
assistant
1/14/2014
1/17/2014
1/17/2014
101
fulltime
8
assistant
1/18/2014
1/24/2014
2/14/2014
102
seasonal
7
manager
1/1/2014
1/3/2014
1/3/2014
102
fulltime
7
manager
1/25/2014
1/25/2014
2/14/2014
102
fulltime
7
manager
1/26/2014
1/26/2014
2/14/2014
102
fulltime
7
manager
1/28/2014
1/28/2014
2/14/2014
102
fulltime
7
manager
1/31/2014
1/31/2014
2/14/2014
103
parttime
5
intern
1/1/2014
1/3/2014
1/3/2014
103
fulltime
6
intern
1/31/2014
1/31/2014
2/14/2014
104
parttime
5
supervisor
1/14/2014
1/17/2014
1/17/2014
104
fulltime
6
supervisor
1/30/2014
1/31/2014
1/31/2014Hello David,
Try this query
set dateformat mdy;
declare @EmpHours table
(Employee int,workday date,payday date,hours int,position varchar(50));
insert into @EmpHours values
(101,'1/1/2014','1/3/2014',8,'assistant'),
(101,'1/3/2014','1/3/2014',8,'assistant'),
(101,'1/4/2014','1/17/2014',8,'assistant'),
(101,'1/5/2014','1/17/2014',8,'assistant'),
(101,'1/7/2014','1/17/2014',8,'assistant'),
(101,'1/8/2014','1/17/2014',8,'assistant'),
(101,'1/9/2014','1/17/2014',8,'assistant'),
(101,'1/11/2014','1/17/2014',8,'assistant'),
(101,'1/13/2014','1/17/2014',8,'assistant'),
(101,'1/14/2014','1/17/2014',8,'assistant'),
(101,'1/18/2014','2/14/2014',8,'assistant'),
(102,'1/1/2014','1/3/2014',7,'manager'),
(102,'1/25/2014','1/31/2014',7,'manager'),
(102,'1/26/2014','1/31/2014',7,'manager'),
(102,'1/28/2014','1/31/2014',7,'manager'),
(102,'1/31/2014','1/31/2014',7,'manager'),
(103,'1/1/2014','1/3/2014',5,'intern'),
(103,'1/31/2014','1/31/2014',6,'intern'),
(104,'1/14/2014','1/17/2014',5,'supervisor'),
(104,'1/30/2014','1/31/2014',6,'supervisor');
--select * from @EmpHours
declare @EmpStatus table
(employee int,start_date date,status varchar(20));
insert into @EmpStatus values
(101,'1/1/2014','parttime'),
(101,'1/18/2014','fulltime'),
(102,'1/1/2014','seasonal'),
(102,'1/18/2014','fulltime'),
(103,'1/1/2014','partime'),
(103,'1/18/2014','fulltime'),
(104,'1/4/2014','parttime'),
(104,'1/18/2014','fulltime');
WITH C AS
SELECT es.employee,es.start_date, es.status, ROW_NUMBER() OVER(partition by employee ORDER BY start_date) AS rownum
FROM @EmpStatus ES
CTE_RANGES as(
SELECT cur.employee,Cur.start_date start_range, cur.status,case when nxt.start_date is null then '2099-12-31' else dateadd(d,-1,Nxt.start_date) end AS end_range
FROM C AS Cur
left JOIN C AS Nxt
ON Nxt.rownum = Cur.rownum + 1 and cur.employee=nxt.employee)
select eh.*,es.status from @EmpHours EH join CTE_RANGES Es on EH.Employee =es.employee and EH.workday between es.start_range and es.end_range
--where es.employee=101
You will need a calender table too which can be joined to the output of the above query to get the weekend dates.
You can find the T-SQL code to generate the calender here
http://stackoverflow.com/questions/19191577/t-sql-function-to-generate-calendar-table
and posting the questions with necessary DDL , DML (like I have posted) would help us a lot.
Satheesh
My Blog -
Get double return for join table
Dear Experts:
SELECT eban~banfn "PR number
eban~bnfpo "PR item
eban~bsart "Doc Type
eban~bednr "Requistion tracking number
eban~ebeln
eban~ebelp
eban~zzloc "GEO code
ztmm_ccp~zzclli "zzclli code
INTO CORRESPONDING FIELDS OF TABLE gi_pr_extract
FROM ( eban
INNER JOIN ztmm_ccp
ON eban~bednr = ztmm_ccp~bednr
AND eban~ebeln = ztmm_ccp~ebeln
AND eban~ebelp = ztmm_ccp~ebelp )
WHERE eban~bsart IN s_bsart. "11 input doc type
The s_bsart are:
NB
UB
ZNB
ZSC
ZUC
ZVC
ZXC
ZZO
ZZX
ZZY
ZZZ
From above SQL, I got double returen for each ebanbanfn and ebanbnfpo
Row BANFN BNFPO BSART BEDNR ZZLOC ZZCLLI
1 3100000056 00010 NB
2 3100000056 00010 NB CLLICD DRTP
3 3100000057 00010 NB
4 3100000057 00010 NB CLLICD DRTP
5 3100000058 00010 NB
6 3100000058 00010 NB CLLICD DRTP
7 3100000061 00010 NB
8 3100000061 00010 NB CLLICD DRTP
9 3100000062 00010 NB
10 3100000062 00010 NB CLLICD DRTP
Do you know why and how do I get the unique one?
Thank you very much!
Helen
Edited by: Thomas Zloch on Oct 4, 2010 3:49 PM - please use code tagsHi Helen,
Please check with the below code snippet. Hope it will work.
SELECT eban~banfn
eban~bnfpo
eban~bsart
eban~bednr
eban~ebeln
eban~ebelp
eban~zzloc
ztmm_ccp~zzclli
INTO CORRESPONDING FIELDS OF TABLE gi_pr_extract
FROM eban
INNER JOIN ztmm_ccp
ON ztmm_ccp~bednr = eban~bednr
AND ztmm_ccp~ebeln = eban~ebeln
AND ztmm_ccp~ebelp = eban~ebelp
WHERE eban~bsart IN s_bsart.
Thanks
Nitesh -
I have 2 tables - customer and order. I am looking to test some join strategies (block nested loop, sort-merge and hash). Could anyone tell me the sql code to perform the joins.
Hi amanda,
Nested Loop: this join is used when you have indexes defined on the join columns. you can use the hint USE_NL.
select /*+ ORDERED USE_NL(b) */ customer_no , order_no
from order a, customer b
where a.customer_no = b.customer_no;
Sort-Merge: suppress the indexes then you shld be able to use sort-merger join or use the hint USE_MERGE, this shld force a sort-merger join.
select /*+ ORDERED USE_MERGE(b) */ customer_no , order_no
from order a, customer b
where a.customer_no = b.customer_no;
Hash Join: use the USE_HASH hint in the query to force the hash join. make sure you have has_area_size parameter set to a value like
700k depending on the memory availability in your machine.hash join builds the hash value of the customer_no from cutomer table in memory and searches for matching records in the order table this is used if you have more memory in your machine.
select /* ORDERED USE_HASH(b) */ customer_no , order_no
from order a, customer b
where a.customer_no = b.customer_no;
may be you can grab some oracle books on sql tuning they explain in great detail about the hints and joins.
Mukundan.
null -
Hello,
Can someone give me the sql to determine what tables and or tablespaces are say 15% fragmented? I'm on Oracle 9i.
thanks...Are you using locally managed tablespaces? If so, you can stop worrying about tablespace fragmentation, particularly if you are using UNIFORM extents.
Can you define "table fragmentation"? I'm hard-pressed to figure out how a table can be fragmented.
Assuming you need to worry about fragmentation in the first place, either because you are still using dictionary managed tablespaces or because you have "table fragmentation" for some definition of the term, can you define what you mean by percentage fragmentation? If you have a dictionary managed tablespace, it is not obvious what it would mean to have a tablespace that was 15% fragmented.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Tablespace design for joined tables
Hello altogether,
Right now I'm designing the database structure for an application requiring high performance on database side.
While thinking about the tablespace structure I came to the following question:
When I am sure that I will have a join on two (or more) tables very often, is it better to put them in one tablespace, or is it better to put them into different tablespaces?
Thanks for your help!
DanielThe tablespace that any particular object is in is irrelevant from a performance standpoint (assuming the tablespace parameters are identical, of course. An object in a dictionary managed tablespace may well have different performance characteristics than an object in a locally managed tablespace using ASSM). Now, if different tablespaces have data files on different physical devices, you may see some performance gains from putting different objects into different tablespaces simply because this would tend to distribute I/O over more physical devices. Of course, you could accomplish the same thing by creating data files on different devices in the same tablespace. And with newer disk subsystems, this sort of manual load balancing tends to be rather pointless.
If you have locally attached storage and you want to distribute I/O across devices by putting objects in different tablespaces rather than assigning multiple data files to the same tablespace, it generally isn't going to matter much which objects are in which tablespace so long as the I/O is relatively evenly distributed (and assuming that there aren't any I/O patterns that need to be accounted for (i.e. if object A is used heavily during the day and object B is used heavily at night and those are the only two objects in the database, putting them in different tablespaces is pointless because you'd never be using the extra spindles simultaneously). You'd have just as much luck putting objects that start with the letters A-L in one tablespace and M-Z in another as putting tables and indexes in different tablespaces or putting related objects in the same tablespace or putting related objects in different tablespaces. So long as I/O gets distributed, it doesn't matter which objects are where.
Personally, I'd never have separate tablespaces for performance. Much easier to have a single tablespace with multiple data files on different devices. Multiple tablespaces should exist for managability reasons, recoverability reasons, and because different objects require different tablespace settings.
Justin -
Create Keys for joining tables
Can I create a data element for a given table that can be used as a joining utility data item for extracting data from two or more tables?
I have a business area with tables that are basically non-relational because of the absence of data elements that are of common name or meaning.Hi,
it will be better if we can have the table structure, depending upon what information we have and there is no join condition between different table you could try with UNION.
--untested
CREATE VIEW VW_TEST AS
select SERIAL_NUMBER , TABLE_NAME FROM table1
UNION ALL
select SERIAL_NUMBER , TABLE_NAME
UNION ALL
select SERIAL_NUMBER , TABLE_NAME
thanks -
Oracle Stored Procedure's TYPE IS RECORD for join table columns
Hi there,
I'm trying to use the type is record to setup all my output columns; However, these columns are joined from 2 or more tables. i.e.,
TYPE my_rec IS RECORD (
myColumn1 varchar2(50),
myColumn2 varchar2(20)
where myColumn1 is slected from a join of table1 and table2, and myColumn2 is selected from a join of table2 and table3.
as I tried to exec mySP, I got the error:
wrong number or types of arguments in call to 'mySP'
I know it is not "wrong number of arguments", but I don't know why these columns are wrong types? though I had TO_CHAR the new myColumn1 and myColumn2, I'm wondering if I should use %TYPE instead. If so, how do I do?
Meanwhile, I think it may help if I post the code here:
===========================================
create or replace package PHAStatusRpt is
type pha_type is record(
name varchar2(50),
pha_start varchar2(12),
current_step varchar2(50),
dates varchar2(25),
last_status varchar2(20)
pha_rec pha_type;
procedure PHAStatusData(ret_parm OUT pha_type);
end PHAStatusRpt;
create or replace package body PHAStatusRpt is
procedure PHAStatusData(ret_parm OUT pha_type) is
BEGIN
SELECT name,
TO_CHAR(DECODE(NVL(current_pha_step_name,'~'),'~',last_pha_date,current_pha_start),'mm/dd/yyyy') pha_start,
DECODE(NVL(current_pha_step_name,'~'),'~','Complete',current_pha_step_name) current_step,
DECODE(NVL(current_pha_step_name,'~'),'~',TO_CHAR(last_pha_date,'mm/dd/yyyy'),pp_date) dates,
DECODE(NVL(current_pha_step_name,'~'),'~',null,last_pha_status) last_status
INTO pha_rec
FROM (SELECT pfeed_name||' ('||TO_CHAR(pfeed_dob,'mm/dd/yyyy')||')' ||'('||SUBSTR(pers_ssn,5,4)||')' name,
current_pha_start,
current_pha_step_name,
last_pha_date,
last_pha_status,
TO_CHAR(pp.start_date,'mm/dd/yyyy')||'-'||NVL(TO_CHAR(pp.end_date,'mm/dd/yyyy'),'n/a') pp_date
FROM v_pers_unit pu, personnel_readiness pr, person_processes pp
WHERE pu.pers_pers_id=pr.pers_id AND pr.current_pha_step_pp_id=pp.pp_id(+) AND cmdstr_cs_id=95990)
ORDER BY name;
end PHAStatusData;
end PHAStatusRpt;
SQL> exec phastatusrpt.phastatusdata
BEGIN phastatusrpt.phastatusdata; END;
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'PHASTATUSDATA'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
============================================
Thanks in advance,
SCcase closed. I found the answer.
-
Feature request - use same colors for joined tables
I brought two datasets into Power Map. Both have a shared segmentation dimension (joined in Power Pivot). Power Map doesn't pay attention to the fact that the tables are joined and does not use the same series colors. I have to manually adjust all
the colors (~2 dozen segments) which is painful and should not be necessary. Power Map should be smart and automatically use the same colors.You are more likely to
produce some effect if you post your request here:
https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform -
ORA-31603:While Extracting SQL of a table I am getting this error.
Hi,
I am getting below error whenever I try to get the SQL for any table. I tried executing DBMS_METADATA() also but the same error is coming.
Please let me know what needs to be done IF I want to extract the DDL for any object.
ORA-31603: object "EMP" of type TABLE not found in schema "MKT"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.DBMS_METADATA", line 3241
ORA-06512: at "SYS.DBMS_METADATA", line 4812
ORA-06512: at line 1
Thanks,
Rusty....Hi,
use AUTHID CURRENT_USER show as below exmaple...
CREATE OR REPLACE FUNCTION xx_get_ddl(
p_object_type IN VARCHAR2
, p_object_name IN VARCHAR2
, p_owner IN VARCHAR2
RETURN CLOB AUTHID CURRENT_USER
IS
v_string CLOB;
BEGIN
SELECT DBMS_METADATA.get_ddl(p_object_type
, p_object_name
, p_owner
INTO v_string
FROM DUAL;
RETURN v_string;
EXCEPTION
WHEN OTHERS
THEN
RETURN NULL;
END; -
Joining tables in different databases
Hi,
I know we can access multiple databases like Oracle, Informix etc. through a single toplink session using session broker. Also in toplink documentation it says there is a work around for joining tables that exists in different databases i.e. joining an Oracle table with an Informix Table. If anyone had tried this or if it is possible, please let me know how to do this.
Thanks..If I could know, how to perform or some sample code, for the following two steps it would be great.
Write descriptor ammendment code to bind together that go from (A) to (B) and (B) to (A).
Be sure to map the ammendment descriptors in the mapping workbench.Or please point me to the right toplink documentation or examples.
Thanks a lot for your help. -
Can we implement the custom sql query in CR for joining the two tables
Hi All,
Is there anyway to implement the custom sql query in CR for joining the two tables?
My requirement here is I need to write sql logics for joining the two tables...
Thanks,
GanaIn the Database Expert, expand the Create New Connection folder and browse the subfolders to locate your data source.
Log on to your data source if necessary.
Under your data source, double-click the Add Command node.
In the Add Command to Report dialog box, enter an appropriate query/command for the data source you have opened.
For example:
SELECT
Customer.`Customer ID`,
Customer.`Customer Name`,
Customer.`Last Year's Sales`,
Customer.`Region`,
Customer.`Country`,
Orders.`Order Amount`,
Orders.`Customer ID`,
Orders.`Order Date`
FROM
Customer Customer INNER JOIN Orders Orders ON
Customer.`Customer ID` = Orders.`Customer ID`
WHERE
(Customer.`Country` = 'USA' OR
Customer.`Country` = 'Canada') AND
Customer.`Last Year's Sales` < 10000.
ORDER BY
Customer.`Country` ASC,
Customer.`Region` ASC
Note: The use of double or single quotes (and other SQL syntax) is determined by the database driver used by your report. You must, however, manually add the quotes and other elements of the syntax as you create the command.
Optionally, you can create a parameter for your command by clicking Create and entering information in the Command Parameter dialog box.
For more information about creating parameters, see To create a parameter for a command object.
Click OK.
You are returned to the Report Designer. In the Field Explorer, under Database Fields, a Command table appears listing the database fields you specified.
Note:
To construct the virtual table from your Command, the command must be executed once. If the command has parameters, you will be prompted to enter values for each one.
By default, your command is called Command. You can change its alias by selecting it and pressing F2. -
Forming generic sql query for joining multiple sap tables in ABAp
Hi,
I am new to this abap field ,facing an issue onsap-jco project . I have used RFC_READ_TABLE FM ,Customized this FM but facing an issue how to write generic open SQl select statement for joining multiple tables using RFC_READ_TABLE .Kindly help on this issue.
Thanks.something like this? If your tuples are not single columns, then you'll have to use dynamic sql to achieve the same result.with
table_1 as
(select '|Xyz|Abc|Def|' tuple from dual
table_2 as
(select '|Data1|Data21|Data31|Data41|Data51|' tuple from dual union all
select '|Data2|Data22|Data32|Data42|Data52|' tuple from dual union all
select '|Data3|Data23|Data33|Data43|Data53|' tuple from dual union all
select '|Data4|Data24|Data34|Data44|Data54|' tuple from dual union all
select '|Data5|Data25|Data35|Data45|Data55|' tuple from dual
select case the_row when 1
then tuple
else '|---|---|' || substr(tuple,instr(tuple,'|',1,3) + 1)
end tuple
from (select substr(a.tuple,instr(a.tuple,'|',:one_one),instr(a.tuple,'|',:one_one + 1)) ||
substr(a.tuple,instr(a.tuple,'|',1,:one_two) + 1,instr(a.tuple,'|',1,:one_two + 1) - instr(a.tuple,'|',1,:one_two)) ||
substr(b.tuple,instr(b.tuple,'|',1,:two_one) + 1,instr(b.tuple,'|',1,:two_one + 1) - instr(b.tuple,'|',1,:two_one)) ||
substr(b.tuple,instr(b.tuple,'|',1,:two_two) + 1,instr(b.tuple,'|',1,:two_two + 1) - instr(b.tuple,'|',1,:two_two)) tuple,
rownum the_row
from table_1 a,table_2 b
order by the_rowRegards
Etbin
Message was edited by:Etbin
user596003
Maybe you are looking for
-
Change Vendor records per Employee Master
Using RPRAPA000 pgm we should be able to update following fields: Names Address Email address- User exit Tax No Bank Details Payment Method Search Term is updated with last name Company Code Fields from Reference vendor u2013 Non HR data Reconciliati
-
I own a Pavillon 6047it, with Windows 32-bit. I got a crash of my HD. After changing it, I tried to reinstall the OS trough the recovery disks I got with the PC. When I start the installation process, I got a message " The CD-ROM drivers are required
-
EPMA Application Deployment issues
What are the issues we ll get when ever we ll deploy an epma application.
-
Is it possible to switch software instruments in mid-track?
Or do you just have to continue the part in a different track with the new instrument?
-
Is there a flash when using the camera on the iPad?
Is there a flash when using the camera on the iPad?