How to get the duplicate(exist) rows in Oracle?
Good morning,
I want to write the query to find the duplicate rows in the table.
SELECT ITEM, MFT_ITEM, MFT, DESC FROM ITEM
In the item table,if MFT_ITEM is coming more than or equal to twice ,it is a duplicate rows.MFT_ITEM is a unique.
ITEM MFT_ITEM MFT DESC
4647 4648 C6253 TOOLS
4647 4648 A0237 TOOLS
10PS 10PS A0027 KITS
10PS 11PS A0028 COVER
12LN 12LN A0034 NUTS
12LN 12LN A0035 NUTS
12LN 13LN A0036 SCREW
4310 4311 00462 POWER
4310 4311 31645 POWER
4310 4311 81205 POWER
I want the results like
ITEM MFT_ITEM MFT DESC
4647 4648 C6253 TOOLS
4647 4648 A0237 TOOLS
12LN 12LN A0034 NUTS
12LN 12LN A0035 NUTS
4310 4311 00462 POWER
4310 4311 31645 POWER
4310 4311 81205 POWER
Please reply
Nicole Thanks for your advise,
I try the below query , I am getting 0 rows.
With t As
Select 4647 ITEM,4648 MFG_ITEM, 'C6253' MFG ,'Tools' Descrip From dual Union All
Select 4647 ,4648 , 'A0237' ,'Tools' From dual Union All
Select 1088 ,1088 , 'A0027' ,'Kits' From dual Union All
Select 1088 ,1188 , 'A0028' ,'Covers' From dual Union All
Select 1245 ,1245 , 'A0034' ,'Nuts' From dual Union All
Select 1245 ,1245 , 'A0035' ,'Nuts' From dual Union All
Select 1245 ,1345 , 'A0036' ,'Screw' From dual Union All
Select 4310 ,4313 , 'A0046' ,'Power' From dual Union All
Select 4310 ,4313 , 'A3164' ,'Power' From dual Union All
Select 4310 ,4313 , 'A0462' ,'Power' From dual
)Select ITEM, MFG_ITEM,MFG,DESCRIP From
Select ITEM, MFG_ITEM,MFG,DESCRIP,
Count(MFG_ITEM) over (Partition By ITEM Order By ITEM) cnt
From t
) Where cnt > 1;
I should get the results like below
ITEM MFG_ITEM MFG DESCRIP
4647 4648 C6253 Tools
4647 4648 A0237 Tools
1245 1245 A0034 Nuts
1245 1245 A0035 Nuts
4310 4313 A0046 Power
4310 4313 A3164 Power
4310 4313 A0462 Power
Please reply
Similar Messages
-
Hi,
i have share point list like below
ID name AdminEmail Useremail URl DueDate UploadSatus
1 ppp [email protected] [email protected] url some date uploaded
2 yyy [email protected] [email protected] url somedate empty
3 xxx [email protected] [email protected] url somedate empty
4 jjj [email protected] [email protected] url somedate emp
AdminEmail and UserEmail are lookup column
i using query the list using caml query
inside of foreach i am checking two condition like below
one is upload status in not empty
i need to send to mail to admin user this part i have done my adding all list items which have datatable apply group by working fine
in send condition i am checking difference between DueDate And current date value
if the value is =1 or -1
if the value is i
thank
i am getting the
table like below
ID name AdminEmail Useremail URl DueDate Upload
2 yyy [email protected] [email protected] url somedate empty
3 xxx [email protected] [email protected] url somedate empty
4 jjj [email protected] [email protected] url somedate empty
my issue is here how can i get the dynamic table rows which are same values of AdminEmail and user email one set and distintict rows are another set
sets which are same emails are same
3 xxx [email protected] [email protected] url somedate empty
4 jjj [email protected] [email protected] url somedate empty
set 2
2 yyy [email protected] [email protected] url somedate empty
how can i get this separate this can any one tell i need to send mail only one time to user [adim and user] .planing to aviod duplicate mail
Srinivasyour case better to use the two data tables to store the data
DataTable dt = list.Items.GetDataTable();
foreach (DataRow row in dt.Rows) -
How to get the number of rows in a repeating frame ?
Hi all,
When I launch a report from forms then sometimes there are data in the report and sometimes there are no data. And the problem is that when there are no data then the frame containing the repeating frame is still displaying and a blank page displays on the report.
So I want to get the number of rows from the repeating frame so that I can code a format trigger on the frame to display or not the enclosing frame depending on the existence of data from the repeating frame.
Thank you very much indeed.Dear Friend,
You can achieve this. Define a summary column (say cnt). Select summary type as "COUNT". select any one of columns that are getting displayed in your repeating frame as summary column and provide "reset at" group name (or set this to report if you are defining this field at report level) . This "cnt" variable will contain how many records that will be fetched for your repeating frame (i.e. Group of Repeating frame). You can use this "CNT" variable in your format trigger.
In this case there is no need to write before report trigger or anything.
Regards,
Manish Trivedi -
How to get the number of rows in a DB-Cursor
When i open a database cursor i do not know how much rows are stored in the cursor. To solve this problem i have to send a 'select count(1) ...' to get the number of rows before i set up the cursor. I think that this is not very clever and could possibly cause performance problems. But i need the num of rows to show the percentage of processed rows. Is there any other way to get the num of rows? May be by checking the cursor directly?
Please help!
Thanx a lotIn order to find out how may rows are going to be processed, oracle has to visit every row. So with a cursor, there is no property that will accurately reflect the number of rows until you get to the last one. That said, you could use
select count(*) over() as row_count, <rest of your columns> FROM <your table>
which will give you the total row count agaist each row in the result set. There are performance penalties involved but they will be less than issuing the query twice, once to get the count and once to get the rows.
Have a look on asktom for some very usefull info about all this.
HTH -
How to get the number of rows in a ResultSet
Hello,
I'm an intern and I'm trying to get the number of rows from result set in oracle using rs.last() and rs.beforeFirst() methods
but I got an error. Could Below is my sample code:
import java.sql.*;
public class SarueckConnect {
public static void main(String[] args) {
Connection con = null;
Statement stmt = null;
ResultSet re = null;
String[] ParamArray;
ParamArray = new String[24];
//Properties logon;
try {
Class.forName("oracle.jdbc.driver.OracleDriver"); //Loading the Oracle Driver.
con = DriverManager.getConnection
("jdbc:oracle:thin:@258.8.159.215:1521:test_DB","data","data"); //making the connection DB.
stmt = con.createStatement ();// Sending a query string to the database
//stmt.executeUpdate("UPDATE test_table set steuk = 6 WHERE steuk = 5");
ResultSet rs = stmt.executeQuery("SELECT mandt,kokrs,werks,arbpl,aufnr,vornr,ile01,"+
"lsa01,ism01,ile02,lsa02,ism02,ile03,lsa03,ism03,ile04,lsa04,ism04,steuk,matnr,budat,"+
"kostl,pernr,rueckid FROM test_table where steuk =6");
//Print the result out.
rs.last(); //This is the line which gives an error.
int rows = rs.getRow();
rs.beforeFirst();// I presume this is wrong to.
ParamArray = new String[24*rows];
int counter=0;
while (rs.next()) {
for (int i = 1; i <= 24; i++){
ParamArray[i-1+(counter*24)] = rs.getString(i);
System.out.print(rs.getString(i) + '\t');
System.out.println();
counter++;
} catch(Exception e) {
e.printStackTrace();
} finally {
try
if(stmt != null) stmt.close();
if(con != null) con.close();
} catch (Exception exception) {
exception.printStackTrace();
TryBapi sap = new TryBapi(ParamArray);
}When I run the code I do have the following ERROR Message:
java.sql.SQLException: Invalid operation for forward only resultset : last
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.driver.BaseResultSet.last(BaseResultSet.java:91)
at SarueckConnect.main(SarueckConnect.java:28)Please could any body Help me out here to figure out how to correct this?
Any Help would be highly apprecited.make your result set scrollable...Not such a good idea. With Oracle, the JDBC driver will read and cache all the ResultSet in memory (with other DBMSs/drivers the behavior will probably be different, but you will still have some unnecessary overhead).
You can do the caching yourself if you think it's worth it. If the piece of code you posted is why you need this for, then use a List or Vector and you won't need to know the size upfront.
Alin,
The jTDS Project. -
How to get the number of rows written to the header of the spool file.
Hi
I need to create a header line for the spool file .
the header line should include fixed length values .
The header should include the number of records found in the table with a maximum begin date (begin_date is the column of the table)
To get the header in the spool file , i wrote a select query has :-
--SPOOL 'C:\Documents and Settings\abc\Desktop\output.TXT'
select 'W'||to_char(sysdate,'MM/DD/YYYYMi:HH:SS')||lpad(max(rownum),9,'000000000') ||'R'||max(to_char(school_from_date,'MM/DD/YYYY')) ||
rpad(' ',76,' ')
from dad.school
group by sysdate;
SPOOL OFF
which gets me all the rows in the table , but i only want the rows with the latest school_begin_date .
how can i achieve that ...
I know that a subquery should be written in the from clause to get the number of rows found with a maximum school_begin_date.
select 'W'||to_char(sysdate,'MM/DD/YYYYMi:HH:SS')||lpad(max(rownum),9,'000000000') ||'R'||max(to_char(school_from_date,'MM/DD/YYYY')) ||
rpad(' ',76,' ')
from dad.school where
select rownum from dad.school
where school_begin_date = max(school_begin_date) ;
the error i get is
ORA-00934: group function is not allowed here
I NEED HELP ..IN GETTING THE ROWNUM JUST FOR THE LATEST BEGIN_DATE ?
PLS HELP ME IN WRITING THE QUERY .
THANKS IN ADVANCE .Try this:
select 'W'||to_char(sysdate,'MM/DD/YYYYMi:HH:SS')||lpad(max(rownum),9,'000000000')||'R'||max(to_char(school_from_date,'MM/DD/YYYY')) || rpad(' ',76,' ')
from dad.school
where school_begin_date = (select max(school_begin_date)
from dad.school); -
How to get the number of rows in a report region
Hi all,
Is there a way to get the number of rows returned in a report region, without issuing an additional "select count(*) from some_table"?
I mean something like the substitution string #ROW_NUM# but for the total rows.
Thanks,
Pedro.http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/ui.htm#CHDDGGEG
For classic report regions, the region footer supports the following substitution strings:#ROWS_FETCHED# shows the number of rows fetched by the Oracle Application Express reporting engine (the page size). You can use these substitution strings to display customized messages to the user. For example:
Fetched #ROWS_FETCHED# rows in #TIMING# seconds.
*#TOTAL_ROWS# displays the total number of rows that satisfy a SQL query used for a report.*
#FIRST_ROW_FETCHED# and #LAST_ROW_FETCHED# display the range of rows displayed. For example:
Row(s) #FIRST_ROW_FETCHED# through #LAST_ROW_FETCHED# of #ROWS_FETCHED# displayed>
Ta,
Trent -
How to get the Newly added fileds from Oracle to BW
Hi ,
We have created the view in the DB side and extracted the data to BW side. After that in the DB side they have added new filed. I want to extract the data for that filed also. But that filed is not displaying in the data source itself. We have deleted the sources system assignment to that particular info source and generated the data source in the source system side, and then also I an unable to get the newly added filed in the data source. We are extracting the data from the ORACLE data base. Please let me know the steps how to get the newly added filed in the data source.
Thanks,
VisuHi Yadav,
yes i have alreday created the info objects in the BW side. In the Oracle DB i can see the fileds in the data sources. Newly added filed is not displaying where as previous all fileds are displaying in the oracle DBside.
Thanks,
Visu -
How to get the available profile names in oracle database
How we can get the available profile names in oracle 11g
Hi;
It isnt to check from dictionary ?
select * from dictionary where table_name like '%PROFILE%'
PS:Please dont forget to change thread status to answered if it possible when u belive your thread has been answered, it pretend to lose time of other forums user while they are searching open question which is not answered,thanks for understanding
Regard
Helios -
How to get the number of rows returned by a report?
Hi,
I'm developing my first application in APEX and so far everything seems fine, except I can't figure out this very simple thing: I have a report based on a PL/SQL block returning an SQL string. I'd like to have a message (something like "X rows returned") just before the report. The closest thing I could find was "X to Y out of Z" in the pagination styles, but that's not what I want. Also I don't think running the same query to get COUNT() is wise.
Any help would be appreciated.
Thanks,
KonstantinMy guess is that it only shows the number of rows it has retrieved. I believe the defailt is for it to only retrieve 50 rows and as you page through your report it retrieves more. So this would just tell you how many rows was retireved, but probably not how many rows the report would contain if you pages to the end. Oracle doesn't really have a notion of total number of rows until the whole result set has been materialized.
-
How to get the Interface inserted rows fom ODI Reporsitory
hi,
I need select query that will select the Interface inserted rows
(Count) from ODI repository tables. because I want to maintain these records into another Oracle tables?????import datetime
import sys
import optparse
document = []
def docprint(string):
document.append('%s' % string)n
def docprintnocr(string):
document.append('%s' % string)
p = optparse.OptionParser()
p.add_option('-a','--server',dest='server',default='XXX',help='The server with the ODI_W catalog')
p.add_option('-b','--beginningday',dest='beginningday',type=int,default=1,help='The day to begin retrieval')
p.add_option('-e','--endingday',dest='endingday',type=int,default=0,help='The day to end retrieval')
p.add_option('-n','--session',dest='session',default='',help='Session to retrieve')
p.add_option('-s','--step',dest='step',action='store_true',help='Print the step data')
p.add_option('-t','--task',dest='task',action='store_true',help='Print the task data')
p.add_option('-x','--recipientlist',dest='recipientlist',default='XXX',help='report recipient(s)')
p.add_option('-y','--mailserver',dest='mailserver',default='XXX',help='mail server')
p.add_option('-z','--mailuser',dest='mailuser',default='XXX',help='mail user')
p.add_option('-p','--printonly',dest='printonly',action='store_true',help='Print, no e-mail')
options,args = p.parse_args()
docprint( '%s %s' \
'\n\tserver=%s' \
'\n\tbeginningday=%s' \
'\n\tendingday=%s' \
'\n\tsession=%s' \
'\n\tstep=%s' \
'\n\ttask=%s' \
'\n\tprintonly=%s'
sys.argv[0]
,datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
,options.server
,options.beginningday
,options.endingday
,options.session
,options.step
,options.task
,options.printonly
if options.server.upper() in ('XXX','YYY'):
catalog = 'ODI_W'
elif options.server in ('WWW','ZZZ'):
catalog = 'SNP_W'
else:
print 'Unknown server %s' % options.server
sys.exit(1)
TimeEnd = datetime.datetime.now() - datetime.timedelta(options.endingday)
TimeBegin = datetime.datetime.now() - datetime.timedelta(options.beginningday)
TimeFormat = '%Y-%m-%d %H:%M:%S'
if options.task:
options.step = True
docprint( '\n%s between %s and %s' %(
options.server
,TimeBegin.strftime(TimeFormat)
,TimeEnd.strftime(TimeFormat)
OptionString = ''
if options.session:
OptionString = '\nPrinting session %s' % options.session
else:
OptionString = '\nPrinting all sessions'
if options.step:
OptionString = '%s %s' % (OptionString,'with step detail')
if options.task:
OptionString = '%s %s' % (OptionString, 'and task detail')
docprint(OptionString)
import pyodbc
ConnectString = 'DRIVER={SQL SERVER};SERVER=%s;DATABASE=%s;Trusted_Connection=yes' % (options.server.upper(),catalog)
try:
Connection = pyodbc.connect(ConnectString,autocommit=False)
Cursor = Connection.cursor()
except Exception, e:
raise RuntimeError, '%s %s connect failed\n%s' % (options.server,catalog,e)
SelectSession = """
select
S.SESS_NO
,S.SESS_NAME
,S.SESS_BEG
,S.SESS_END
,coalesce(S.SESS_DUR,0)
,S.SESS_STATUS
,S.CONTEXT_CODE
from SNP_SESSION as S
where S.SESS_BEG between ? and ?
and S.SESS_BEG = (
select max(SESS_BEG)
from SNP_SESSION
where SESS_NAME = S.SESS_NAME)
order by S.SESS_BEG ASC
SelectSessionHistory = """
select Top 3
SESS_NO
,SESS_NAME
,SESS_BEG
,SESS_END
,coalesce(SESS_DUR,0)
,SESS_STATUS
,CONTEXT_CODE
from SNP_SESSION
where SESS_NAME = ?
and SESS_NO <> ?
order by SESS_BEG DESC
SESS_NO = 0
SESS_NAME = 1
SESS_BEG = 2
SESS_END = 3
SESS_DUR = 4
SESS_STATUS = 5
CONTEXT_CODE = 6
SelectStep = """
select
LOG.STEP_BEG
,LOG.STEP_END
,coalesce(LOG.STEP_DUR,0)
,LOG.STEP_STATUS
,coalesce(LOG.NB_ROW,0)
,coalesce(LOG.NB_INS,0)
,coalesce(LOG.NB_UPD,0)
,coalesce(LOG.NB_DEL,0)
,coalesce(LOG.NB_ERR,0)
,STEP.STEP_NAME
,STEP.NNO
from SNP_STEP_LOG LOG
inner join SNP_SESS_STEP STEP
on STEP.SESS_NO = LOG.SESS_NO
and STEP.NNO = LOG.NNO
WHERE LOG.SESS_NO = ?
ORDER BY STEP.NNO
STEP_BEG = 0
STEP_END = 1
STEP_DUR = 2
STEP_STATUS = 3
NB_ROW = 4
NB_INS = 5
NB_UPD = 6
NB_DEL = 7
NB_ERR = 8
STEP_NAME = 9
STEP_NO = 10
SelectTask = """
select
LOG.TASK_BEG
,LOG.TASK_END
,coalesce(LOG.TASK_DUR,0)
,LOG.TASK_STATUS
,coalesce(LOG.NB_ROW,0)
,coalesce(LOG.NB_INS,0)
,coalesce(LOG.NB_UPD,0)
,coalesce(LOG.NB_DEL,0)
,coalesce(LOG.NB_ERR,0)
,TASK.TASK_NAME3
from SNP_SESS_TASK_LOG LOG
inner join SNP_SESS_TASK TASK
on TASK.SESS_NO = LOG.SESS_NO
and TASK.NNO = LOG.NNO
and TASK.SCEN_TASK_NO = LOG.SCEN_TASK_NO
WHERE LOG.SESS_NO = ?
AND LOG.NNO = ?
ORDER BY LOG.SCEN_TASK_NO
TASK_BEG = 0
TASK_END = 1
TASK_DUR = 2
TASK_STATUS = 3
TASK_ROW = 4
TASK_INS = 5
TASK_UPD = 6
TASK_DEL = 7
TASK_ERR = 8
TASK_NAME = 9
SessionStatuses = {'M':'Warning','E':'Err','D':'Done','R':'Run'}
StepStatuses = {'M':'Warn','E':'Err','D':'Done','W':'Wait','R':'Run'}
SessionRows =Cursor.execute(SelectSession,(TimeBegin,TimeEnd)).fetchall()
for SessionRow in SessionRows:
if options.session and options.session.upper() != SessionRow[SESS_NAME].upper():
# Not requested
continue
if SessionRow[SESS_NAME] in ('SOCKETSERVER','PROCESSHUB'):
# Skip these utilities
continue
if SessionRow[SESS_STATUS] == 'R':
# Still running, nothing to print(
docprint( '\n%s, status %s' % (
SessionRow[SESS_NAME]
,SessionStatuses[SessionRow[SESS_STATUS]]
continue
if SessionRow[SESS_END]:
SessionEnd = SessionRow[SESS_END].strftime(TimeFormat)
else:
SessionEnd = ' '
SessionHistories = Cursor.execute(SelectSessionHistory,(SessionRow[SESS_NAME],SessionRow[SESS_NO])).fetchall()
docprintnocr( '\n%-20s\n\t%s / %s %6i secs %s' % (
SessionRow[SESS_NAME][:20]
,SessionRow[SESS_BEG].strftime(TimeFormat)
,SessionEnd
,SessionRow[SESS_DUR]
,SessionStatuses[SessionRow[SESS_STATUS]]
for SessionHistory in SessionHistories:
if SessionHistory[SESS_END]:
SessionHistoryEnd = SessionHistory[SESS_END].strftime(TimeFormat)
else:
SessionHistoryEnd = ' '
docprintnocr( '\t%s / %s %6i secs %s' % (
SessionHistory[SESS_BEG].strftime(TimeFormat)
,SessionHistoryEnd
,SessionHistory[SESS_DUR]
,SessionStatuses[SessionHistory[SESS_STATUS]]
if not options.step:
# Step detail not requested
continue
docprint( '\n %-22s %5s %4s %8s %8s %8s %8s %8s' % (
,'Secs'
,'Stat'
,'Rows'
,'Inserts'
,'Updates'
,'Deletes'
,'Errors'
for StepRow in Cursor.execute(SelectStep,SessionRow[SESS_NO]).fetchall():
try:
docprint( ' %-22s %5i %-4s %8i %8i %8i %8i %8i' % (
StepRow[STEP_NAME][:22]
,StepRow[STEP_DUR]
,StepStatuses[StepRow[STEP_STATUS]]
,StepRow[NB_ROW]
,StepRow[NB_INS]
,StepRow[NB_UPD]
,StepRow[NB_DEL]
,StepRow[NB_ERR]))
except Exception, e:
docprint(e)
continue
if not options.task:
# Task detail not requested
continue
try:
for TaskRow in Cursor.execute(SelectTask,(SessionRow[SESS_NO],StepRow[STEP_NO])).fetchall():
docprint( ' %-21s %5i %-4s %8i %8i %8i %8i %8i' % (
TaskRow[TASK_NAME][:21]
,TaskRow[TASK_DUR]
,TaskRow[TASK_STATUS]
,TaskRow[TASK_ROW]
,TaskRow[TASK_INS]
,TaskRow[TASK_UPD]
,TaskRow[TASK_DEL]
,TaskRow[TASK_ERR]
except Exception, e:
docprint( e )
docprint( '\nEnd of report')
Connection.close()
if options.printonly:
for line in document:
print line
sys.exit(0)
import smtplib
Message = """From: %s
To: %s
MIME-Version: 1.0
Content-type: text/html
Subject: %s
<font face="courier" size="4"><b>%s</b></font>
options.mailuser
,options.recipientlist
,'Session Report'
,'<br>'.join(document).replace('\n','<br>').replace('\t',' ').replace(' ',' ')
server = smtplib.SMTP(options.mailserver)
server.sendmail(options.mailuser,options.recipientlist,Message)
server.quit() -
How to get the number of rows in a HTML table in some other page
Hi,
I am incrementing HTML table rows on button click and saving number of rows in a javascript variable. But on submitting that page I need that number of row value in the following page
example:
HTML table is in the page first.jsp
and the javascript variable having the current row number is row_number
on submitting it goes to second.jsp page. There i need that row_number value.
Can anyone help me to solve this?
regards,
carryfunction buttonClick()
var table = profileTable;
var lnRow = table.rows.length;
var insertedRow = table.insertRow(parseFloat(lnRow));
var cell1 = insertedRow.insertCell();
cell1.innerHTML ="<tr><td><Input type=\"hidden\" >>>name=\"rowNum\" value="+cnt"+></td></tr>";
document.profileform.submit;
on submit it goes to the second page, but the value i got using >>>System.out.println("row number from text >>>box"+request.getParameter("rowNum")); is null. What is wrong with >>>my coding. Can anyone solve this.HI carry
Check the value of bold data
function buttonClick()
var table = profileTable;
var lnRow = table.rows.length;
var insertedRow = table.insertRow(parseFloat(lnRow));var cnt=inRow
var cell1 = insertedRow.insertCell();
cell1.innerHTML ="<tr><td><Input type=\"hidden\" >>>name=\"rowNum\" value="+cnt+"></td></tr>";
document.profileform.submit;
}try with it -
How to get the Query Layout (Rows & Column fields)
Hi,
Any idea where in the backend repository the SAP BW query attributes are stored.
I have created a Query using Query analyzer and i would like to where exactly this query info is stored. is there any BAPI that would give this info if i provide the query name?
Thanks,
RamHi Ram,
You can see the query details from Metadata repository. againest perticular infoproviders and quiries.
Hope it Helps
Srini -
How to get the correct sql command in oracle?
Hi sir,
i am using this query in sql that is :
SELECT C.*,ISNULL(P.Comp_Name,'') + ' (' + ISNULL(P.Comp_ID,'') + ')' Parent FROM Comp_Master C LEFT JOIN Comp_Master P ON C.Parent_ID = P.Comp_ID Where C.Comp_ID='004'
so i am getting in parent column value like this: "PARIS GROUP (001)"
but the same command i converted in sql developer that is:
SELECT C.* ,NVL(P.Comp_Name, ' ') || ' (' || NVL(P.Comp_ID, ' ') || ')' as Parent FROM Comp_Master C LEFT JOIN Comp_Master P ON C.Parent_ID = P.Comp_ID WHERE C.Comp_ID ='004'
but not getting in parent column value its coming only ( )
help me.
thanksWelcome to Oracle.
It has manuals.
http://tahiti.oracle.com/
Choose your version, which you continue to keep a mystery
E.g.
http://www.oracle.com/pls/db112/homepage
Including Oracle SQL syntax
http://docs.oracle.com/cd/E11882_01/server.112/e26088/toc.htm
Which you will find useful since Oracle does not run Microsoft SQL as you continue to find over and over again.
And there is a 2 day getting started as a developer guide, which you appear to desperately need,
http://docs.oracle.com/cd/E11882_01/appdev.112/e10766/toc.htm
If you have any specific questions about anything you read in there, come back in a couple of days after you have finished reading them. -
How to get the correct stored procedure in oracle
Hi sir,
i am having one stored procedure which i converted from sql it's compiled successfully.
create or replace
PROCEDURE Spvalidateholiday1
v_pidate1 IN Date DEFAULT NULL ,
v_piEmpid IN VARCHAR2 DEFAULT NULL ,
v_pidate2 IN Date DEFAULT NULL ,
v_poRetVal OUT Number
--RETURN NUMBER
AS
v_date3 VARCHAR2(20);
v_date4 VARCHAR2(20);
v_date5 VARCHAR2(40);
v_date6 VARCHAR2(40);
v_scode VARCHAR2(10);
v_dayoff1 VARCHAR2(20);
v_dayoff2 VARCHAR2(20);
BEGIN
v_date5 := To_Char(To_Date(v_pidate1,'YYYY-MM-DD','D'));
v_date6 := To_Char(To_Date(v_pidate2,'YYYY-MM-DD','D')) ;
SELECT Shift_Code
INTO v_scode
FROM Employee
WHERE Emp_ID = v_piEmpid;
SELECT WeeklyOff1
INTO v_dayoff1
FROM Shift
WHERE Shift_Code = v_scode;
SELECT WeeklyOff2
INTO v_dayoff2
FROM Shift
WHERE Shift_Code = v_scode;
SELECT dayid
INTO v_date3
FROM Weekly
WHERE dayss = v_dayoff1;
SELECT dayid
INTO v_date4
FROM Weekly
WHERE dayss = v_dayoff2;
--select @date3=dayid from Weekly w join Site_Param s on w.dayss=s.WeeklyOff1
--select @date4=dayid from Weekly w join Site_Param s on w.dayss=s.WeeklyOff2
IF ( v_date5 = v_date3
OR v_date6 = v_date4
OR v_date4 = v_date5
OR v_date3 = v_date6 ) THEN
BEGIN
v_poRetVal := 0 ;
END;
ELSE
BEGIN
v_poRetVal := 1 ;
END;
END IF;
RETURN; --v_poRetVal;
END;
but getting error:
ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'SPVALIDATEHOLIDAY1' ORA-06550: line 1, column 7: PL/SQL: Statement
could u check the stored procedure?
thanksHi sir,
i am calling it my application
that is used like this
Dim hshParam As New Hashtable
hshParam.Add("Empid", '00000002')
hshParam.Add("date1", '2012-10-25')
hshParam.Add("date2", '2012-10-27')
intRetProc = objDataTier.ExecuteStoredProcedureWithReturnT("Spvalidateholiday1", hshParam)
and here is this method written:
Public Function ExecuteStoredProcedureWithReturnT(ByVal sStroredProcedureName As String, ByVal phshTbl As Hashtable) As Integer
Dim cmdCommand As OracleCommand
Dim prmParmOutput As OracleParameter
Dim pParam As IDictionaryEnumerator = phshTbl.GetEnumerator
Dim sKey As String, sValue As String
Try
ExecuteStoredProcedureWithReturnT = True
OpenDbConnection()
cmdCommand = New OracleCommand(sStroredProcedureName, conConnection)
cmdCommand.CommandType = CommandType.StoredProcedure
cmdCommand.CommandTimeout = 0
While pParam.MoveNext
sKey = "v_pi" & pParam.Key
sValue = pParam.Value
cmdCommand.Parameters.Add(New OracleParameter(sKey, sValue))
End While
prmParmOutput = New OracleParameter
cmdCommand.Parameters.Add(New OracleParameter("v_poRetVal", SqlDbType.Int)).Direction = ParameterDirection.Output
' If
cmdCommand.ExecuteNonQuery()
ExecuteStoredProcedureWithReturnT = CInt(cmdCommand.Parameters("v_poRetVal").Value)
Catch ex As Exception
ExecuteStoredProcedureWithReturnT = 2
Throw ex
End Try
End Function
now tell me is it correct?
Maybe you are looking for
-
How to know if a scrollbar is been drawn if the JScrollPane is not visible.
I have a JTabbedPane with one JPanel in each tab. Each of these panels contains one JLabel with a JTextBox on the top and under it the rest is filled with a JScrollPane containing a JTable. I am using a GridBagLayout. Now, the requirement is that the
-
Need Bridge for Mac to download software update for Xperia Z1?
Trying to update the software, but the only instructions it has are to download Bridge for Mac? How do I do this if I don't have a Mac computer? I'm WIndows. Thanks.
-
What is the ideal scanner setting to capture old photos
I have several very old photos that I want to scan using a Canoscan 9950F and incorporate them into a video. I was told by the person who has some of these old photos that she has some on CD at 300dpi. I plan to add motion to some of the old photos a
-
I get error Client 000 has status 'not modifiable' How to solve it?
-
Can I bypass the "computer says NO mentality"?
Hi, I recently had a BT engineer out to my hosue to fix a phone line problem. Superb bloke. I wish all those people in sales were as useful as this guy. I mentioned my slow BB speed and lack of infinity (separate topic elsewhere..) and he mentione