How To Print Sql Query With Serial Number

Mar 27, 2007

How can i print serial no of records in sql query? I know I can achieve this with selecting rownum but it gives wrong data if used with group by like below

select rownum,deptid from emp group by rownum,deptid order by rwnum

View 2 Replies


ADVERTISEMENT

SQL & PL/SQL :: How To Get Serial Number

Mar 12, 2013

I have following table.

CREATE TABLE ABC
(
DPT_NUM NUMBER,
LOT_NUM NUMBER,
ASSOCIATED_WITH_LOT NUMBER
);
SET DEFINE OFF;
Insert into ABC
[code]......

Now i run follwoing query and result is

select * from abc
DPT_NUMLOT_NUMASSOCIATED_WITH_LOT

1501
1502501
1509501
1511
1503
1516
1522
1565
1569565
2601
2602
2604602
2607
2508

I need following result

DPT_NUMLOT_NUMASSOCIATED_WITH_LOT Serial_Number

1501 1
1502501 2
1509501 2
1511 3
1503 4
1516 1
1522 2
1565 3
1569565 3
2601 1
2602 2
2604602 2
2607 3
2508 3

Note that serial number must reset after each 4 lot_num againt dpt_num. Not that where lot is associated in associated_with_lot there serial number must be same as serial number is for associated lot.

View 7 Replies View Related

SQL & PL/SQL :: How To Maintain Serial Number

Aug 4, 2012

I have one table as per the attachment, with id(Primary key),level,name and Srno.Now I want to maintain Sr. if user transfers level 2 of one block (level 1) to another block.is it possible through any oracle function.

View 8 Replies View Related

PL/SQL :: Serial Number - Translate ID From TBL-ID2 To TBL-ID?

Jun 30, 2012

I have two tables,

CREATE TABLE TBL_ID(
SERIAL NUMBER(3),
ID NUMBER(5));
CREATE TABLE TBL_ID2(
ID NUMBER(5));

[code]...

I want translate id from TBL_ID2 to TBL_ID, and make new serial as  max serial + 1 I tried

insert into TBL_ID(serial,id)
select (select max(serial) + 1 from ),id from TBL_ID2
Desired Output after insert
select * from TBL_ID

SERIAL   ID
------   --
1        10
2        20
3        50
4        60
5        90

View 3 Replies View Related

SQL & PL/SQL :: Get Desire Serial Number?

Jul 31, 2013

I have follwoing Table

create table abc( prd_cod number,tax_num number, tkt_num number,shd_cod number,cnt_num number,ctn_num number);
Insert into ABC(PRD_COD, TAX_NUM, TKT_NUM, SHD_COD, CNT_NUM, CTN_NUM) Values (1, 1, 1, 1, 1, 1);
Insert into ABC(PRD_COD, TAX_NUM, TKT_NUM, SHD_COD, CNT_NUM, CTN_NUM) Values (1, 1, 1, 1, 2, 1);
Insert into ABC(PRD_COD, TAX_NUM, TKT_NUM, SHD_COD, CNT_NUM, CTN_NUM) Values (1, 1, 1, 2, 1, 1);

[code]...

Now i have following data

PRD_CODTAX_NUMTKT_NUMSHD_CODCNT_NUMCTN_NUM

111111
111121
111211
112111
151211
211111

I need to query above data with a column "Srl_Num". Its serial number and serial should like 'AA1','AB1'. In serial number is last digit 1 is "Ctn_Num" Column Value. First Letter 'A' of serial number is 'A' and second letter of serial number will change. When it reaches till 'Z' Then first letter will change.I mean if serial number is 'AZ1' Then next serial number will be 'BA1','BB1','BC1' and so on.

I need query to show data like

Srl_Num PRD_CODTAX_NUMTKT_NUMSHD_CODCNT_NUMCTN_NUM

AA1 111111
AB1 111121
AC1 111211
AD11 12111
AE1 151211
AF1 211111

View 3 Replies View Related

Forms :: How To Generate Serial Number

Aug 23, 2011

how do you generate serial numbers? i have an invoice where i have to add items, so i want the numbering to start from 1 everytime i start a new form and increment by 1 as i i enter a new record. For this i have put my code in when-new-record-instance but problem is if i delete a record and enter a new one, the serial number starts from the nex number.

For ex. if i have 4 items with serial numbers 1, 2, 3, 4 and i delete the item at no. 3 and add a new item , the serial number comes as 5.

proper code to generate the serial numbers?

View 7 Replies View Related

Forms :: Generating Sequence - Get Serial Number?

Dec 21, 2011

i want to get serial numbers in oracle forms. i have one data block with 10 rows and a non database display item with corresponding length as that of the original data block .

when ever i am executing the form i want to see the serial number generated in the display item and when i inserted a new item or row it should show the corresponding rownum.

eg:

empno name serialno
5 tom 1
4 tinil 2
6 sofy 3
7 john 4
1 albert 5
2 michel 6

i want to get the above answer using forms.

View 7 Replies View Related

Forms :: Serial Number In Tabular Style Form?

Feb 9, 2010

I need Sequence generate in each row in tabular style form

Like

FA0015
FA0016
FA0017

(I dont want to use sequence because when i delete the row its conceder delete row in sequence )

View 4 Replies View Related

Forms :: Applying Serial Number In Detail Block

Sep 5, 2011

I have form with master detail relation ship (invoicing form) the detail block is tabular, displaying upto 7 records...

Now my clients wants to show the serial number along with each record while feeding the data (this includes when insert, editing, deleting / clearing records) he wants to see the serial number as in MS access / MS techniques.

I tried to use the system variable to use :system.cursor_record; but this dose not works.(in insert/edit/delete/clear record)

View 5 Replies View Related

Forms :: Simple Data Block - Serial Number Generation

Jun 2, 2010

I have created simple data block by wizard and taken tabular layout 10 rows and 6 columns

i want to generate serial number on first column .....

what need to use..?

View 11 Replies View Related

SQL & PL/SQL :: How To Print All Prime Factors Of Given Number

Sep 3, 2012

print the list of prime factors of a given number create or replace FUNCTION prime (num in number)

return sys_refcursor
as
i number := 2;
temp number := num;
temp_cur sys_refcursor;
BEGIN
open temp_cur;

[code]....

Quote:gives error -->>expression is of wrong type @ open temp_curur;

how to print all the prime factors of a given number??

View 9 Replies View Related

PL/SQL :: Print Number Within Trigger On Console

May 27, 2013

My oracle database version : 10G

I have the following code on my employees table, lets say I fire an update on my employees table and in return 6 rows gets updated, I want to print this number within my trigger on the console, I have put a comment in my code where I want to achieve this.

<code>
create or replace trigger trig_employees_au
after update on employees
declare
     Linst_file utl_file.file_type;
[code]....

View 12 Replies View Related

SQL & PL/SQL :: Print Output Of Query In Excel Format?

Aug 4, 2010

Is it possible to print the output of a sql query in Excel format without using third party tools like Toad, Hora or any front end Application.

View 10 Replies View Related

Client Tools :: Unable To Print Query Output On TOAD

Jan 24, 2012

When i run the below mentioned query(similar query)on TOAD. It will run without any errors and i can see "PL/SQL Procedure successfully completed" in the task bar.....

However i am unable to see the output for the query.

print the the query output on TOAD ....

**** Sample Query Starts *****
DECLARE
i PLS_INTEGER;
BEGIN
SELECT NVL(i, 93)
INTO i
FROM DUAL;
--print i;
--dbms_output.put_line('i1: ' || i);
END;
**** Sample Query Ends*****

**** Actual Query Starts *****
-----------------------------------------------------------------
DECLARE
UnxDate number(6);
MyResult number(6);
Todaysdate date := TO_DATE('17-01-2012 00:00:00','dd-mm-yyyy hh24:mi:ss');
BEGIN
SELECT ROUND (Todaysdate - TO_DATE('01-jan-1970','dd-mon-yyyy') ) INTO UnxDate FROM dual;
[code]......

View 9 Replies View Related

SQL & PL/SQL :: Print Ename And Salary Of Employee Using Employee Number As Input

Aug 11, 2013

/* Formatted on 2013/08/11 18:46 (Formatter Plus v4.8.8) */
CREATE PROCEDURE p_get_name (
p_empno IN OUT NUMBER,
p_name OUT VARCHAR2,
p_err OUT NUMBER
[code].......

Note:- I want to print ename and salary of emp using empno as a input but i dont want to declare extra variable for salary , i want to print salary using empno but when i execute this procedure. It gives value of empno in salary. Don't Know Why , how can i print salary of emp using empno as input without declaring extra variable for salary.

View 25 Replies View Related

SQL & PL/SQL :: Print No Results If More Than 10 Records Else Print The Output

Mar 24, 2011

I have this SQL statement:

WITH data
AS (SELECT user_id,
jc_name,

[Code]....

I wish to do something like

if results > 10 print an error message (and no results)
if results < 10 print the results/output

View 1 Replies View Related

SQL & PL/SQL :: How To Generate Number (not Sequence Number) In Query

Mar 9, 2011

I have the following select query that works perfectly fine. Returns 25 rows based on the descending order of the price.But, I want add one more expression to this list of columns in this query (apart from customer_id).

the expression should look like Cust-01 for the first customer from the below query all the way to Cust-25 for the last customer.But how can I can generate 01 to 25 in oracle?

select customer_id from
(select customer_id from capitalPLAN
where member_status = 'MEMBER' AND customer_id NOT in ('156','201','1385','2125','3906','165')
order by price desc
)
where rownum <= 25

View 4 Replies View Related

SQL & PL/SQL :: Conditionally Re-arrange The Serial?

Jan 21, 2013

I want to conditionally re-arrange the serial. Sample test case is as below.

DROP TABLE t1;
CREATE TABLE t1
(

[Code].....

SQL> Select * from t1 order by no;

NO T
---------- -
1245 R
1246 N
1247 N
1248 R
1249 R
1250 R
1251 N
1252 N
1253 R
1254 R
1255 N

11 rows selected.

Required output is

OLD_NO T NEW_NO
---------- - --------
1245 R 1245
1246 N 1247
1247 N 1251
1248 R 1248
1249 R 1249
1250 R 1250
1251 N 1252
1252 N 1255
1253 R 1253
1254 R 1254
1255 N 1256

Scnario is to add 1 in no. field but no.s having type 'R' will remain unchanged. e.g. Record no. 1247 is changed to 1251 because 1248,1249,1250 have typ 'R'.

View 12 Replies View Related

PL/SQL :: How To Run DBMS_JOB In Parallel And Serial

Jul 26, 2012

I have total 8 procedure to run in parallel . and after that my 9th procedure should run.

below is my job submission procedure

create or replace procedure DURATION_ALARM_WEEKLY as
l_job number ;
begin
dbms_job.submit(l_job,'begin ALARMS_WEEKLY_CALL_OUT ; end;');
dbms_job.submit(l_job,'begin ALARMS_WEEKLY_CALL_IN ; end;');
dbms_job.submit(l_job,'begin ALARMS_WEEKLY_DURATIN_OUT ; end;');
[code].......

what is the syntax I have to do in my FINALE procedure . using DBMS_ALERT.REGISTER , DBMS_ALERT.WAITANY .....?

View 9 Replies View Related

Exadata :: How To Get The Serial Numbers From Switches

Mar 20, 2013

My management is wanting to know the serial numbers of all the components of our two Exadata machines: one quarter-rack V2 and one half-rack V1

I can use dmidecode to get the appropriate information for comp nodes and storage cells, but not for the Cisco/Voltaire switch, nor the IB switches. I read MOS 1299791.1 and the thought of asking a DOC operative to pull out the label ‘which could damage the switch’ worries me quite a bit.

Is it still true that we are unable to obtain the serial number for the IB switches and the Cisco/Voltaire switches from the CLI of the switches themselves? Sad face.

View 8 Replies View Related

SQL & PL/SQL :: Validation Of PAN Number In Query?

Jun 5, 2013

create TABLE pan_number(pan CHAR(10) NOT NULL);
INSERT INTO pan_number(pan) VALUES('ABCDE1234A');
INSERT INTO pan_number(pan) VALUES('FGHIG5678F');
INSERT INTO pan_number(pan) VALUES('ABCDE12345');
INSERT INTO pan_number(pan) VALUES('ABCD1234A');
select * from pan_number;

now i need to validate valid PAN number which is of " The first 5 letters should be alphabets & last letter as alphabet & total length of PAN no. should be 10 digit"

i need to display valid PAN number , only first two rows are valid PAN numbers.

View 12 Replies View Related

Forms :: Read Data From Serial Port?

Jun 16, 2004

I'm trying to read some data from external device via COMM Port.

Application is running n server and device is connected localy on my PC.

My device iz DPI605R for purpose of� pressure measuring.

View 6 Replies View Related

Forms :: Communication With Serial Device (via COM1)

Jan 3, 2012

Is it possible to communicate with a serial device (via COM1) with oracle forms / webutil? I am able to communicate in java using RXTXcomm, but I am having problems making a bean that uses it (getting security errors and yes, I have signed the jars).

Basically, I have a scale hooked up to my COM1 port and want to be able to send commands (zero and tare) to it and read the weight from it through a form or java bean.

View 5 Replies View Related

Query To Know Number Of Columns In A Table?

Apr 4, 2008

query to know number of columns in a table i.e.

if I want to know how many number of colums are present in a specific table then what would be the query.

View 1 Replies View Related

Select Number Of Rows From Query?

Jun 13, 2007

In sql plus How do I get the number of distinct rows of a certain value?

for example

select group_number from records group by group_number

How would I query for the total number of group_numbers in this query?

View 2 Replies View Related

SQL & PL/SQL :: Query To Get Sequence Number In Group

Dec 7, 2010

I have Table Data in format :-

--------------------------
ABC
ABC
ABC
XYZ
XYZ

and i have a requirement where I need the output in this format.

-------------
ABC 1
ABC 2
ABC 3
XYZ 1
XYZ 2

what query to be used for this

View 2 Replies View Related

SQL & PL/SQL :: Query To Find The Number Of Alphabets?

Apr 20, 2013

I need to find out that assume i have a table having 2 column

Num Name
1 Adam
2 Akanksha
1 barren
2 bosli
3 Benergee
4 Bhawna
3 anjani

I want a query as if A is there 2 times then there should be 1 then 2 then there is b coming in 4 places then it should be 1 2 3 4 and again there is anjani so 3 should be there as 1 and 2 in first 2 places and the num should be automatically generated number based on the count of the alphabets

View 6 Replies View Related

SQL & PL/SQL :: Get Port Number In Database With Query?

Mar 5, 2010

How to get a port number in database with a sql query.

View 10 Replies View Related

Forms :: Transfer Data From Oracle 9i To Serial Port?

Feb 14, 2012

I want to transfer data from Oracle form 9i to serial port.

Serial port is connected to electric board to show.

View 2 Replies View Related

Oracle - SQL Query For Number Of Days Since Last Backup

Oct 20, 2011

Is there any Oracle query I can run to determine the "number of days since the last backup"? SQL Server provides this data but I cant seem to find the equivalent for Oracle. Looks like there may be some information like this via RMAN tables and if so I want to create the simplest query possible to obtain that information.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved