SQL & PL/SQL :: Function To Accept 4 Digit Number Which Should Not Be Repeated?

Aug 15, 2012

i nee a function which accepts 4 digit number and in four digit number the number should not be repeated. i want all the number in the output.

ex:1234
2367
1262(is not valid)

View 20 Replies


ADVERTISEMENT

PL/SQL :: Function That Returns The Check Digit Of 9-digit Number

Jan 17, 2013

I would like a pl/sql function that returns the check digit of a 9-digit number?

Look at

[UR]......

For example number 109409714 (9 digits) should do check digit. I want validation of check digit, & want to return the check digit.

View 8 Replies View Related

SQL & PL/SQL :: Replacing 4 Digit Number In A Given String With The Same Number Incremented By 10000?

Jun 17, 2010

i want to replace 4 digit number in a given string with the same number incremented by 10000.

That mean in the given sting 1201 should be replace by 11201 (Icremented BY 10000).

Input String:

<query><matchAll>true</matchAll><row><columnId>1201</columnId><dataType>31</dataType><op>Like</op><val>North America - Houston</val></row><row><columnId>1212</columnId><dataType>31</dataType><op>!=</op><val>Agreement Date Mismatch</val></row><row><columnId>1212</columnId><dataType>31</dataType><op>!=</op><val>Facility Type Mismatch</val></row><row><columnId>1224</columnId><dataType>31</dataType><op>Like</op><val>y</val></row></query>

Required output :

<query><matchAll>true</matchAll><row><columnId>11201</columnId><dataType>31</dataType><op>Like</op><val>North America - Houston</val></row><row><columnId>11212</columnId><dataType>31</dataType><op>!=</op><val>Agreement Date Mismatch</val></row><row><columnId>11212</columnId><dataType>31</dataType><op>!=</op><val>Facility Type Mismatch</val></row><row><columnId>11224</columnId><dataType>31</dataType><op>Like</op><val>y</val></row></query>

View 7 Replies View Related

SQL & PL/SQL :: Extract Number And Previous Character From Where 5 Digit Number Starting

Oct 21, 2011

I have a text field and if the text field has 5 consecutive numbers then I have to extract the number and the previous character from where the 5digit number starting

For example i/p asdfasfsdS251432dasdasd o/p should be S251432

View 10 Replies View Related

Fix Number Of Digit After Decimal Point?

Mar 21, 2007

I have a small prob. I want an amount to be always 2 decimal places. I've used the Round function - Round(amount,2). the problem is that if the amount is only to 1 dp like 1.4. the above function will return 1.4. I want it to appear like 1.40

View 2 Replies View Related

PL/SQL :: Number Range Query Causes Repeated Scan By Index

Oct 16, 2012

I have a query that seems to repeatedly call an index scan on a table for reasons I'm not sure about. Why it would be doing the index scan on totaldwellingarea in the dimensions table (DIMEN_PID_TDWELLAREA) repeatedly? This only seems to happen when I put on the range clause d.totaldwellingarea between scr.lowvalue and scr.highvalue.

I am using Oracle version 9.2.0.3.

select d.propertyid,d.totaldwellingarea, e.size_,  scr.size_
from  eqid e, dimensions d,  brt_eval.size_code_ranges scr
where e.style not in ('1','A','G','L') and e.size_  = '0'
and d.propertyid = e.propertyid and e.style = scr.style and d.totaldwellingarea between scr.lowvalue and  scr.highvalue;

CREATE
  TABLE "BRT_ADMIN"."EQID"
  (
    "PROPERTYID"   VARCHAR2(20 BYTE) NOT NULL ENABLE,
    "EQID"         CHAR(10 BYTE),
    "ZONE_"        CHAR(1 BYTE),
    "AREA"         CHAR(1 BYTE),
[code].....

View 3 Replies View Related

Generate Random And Unique 6 Digit Number In Oracle

Sep 29, 2008

I need to generate random and unique 6 digit number in Oracle. I need to insert these numbers into a table. I tried using DBMS_RANDOM package, which generates random 6 digit numbers, but fails to generate UNIQUE numbers.

View 3 Replies View Related

PL/SQL :: Round Function Output Depend On 2nd Digit After Decimal Point

Oct 19, 2012

I have a question on Round Function

Round(###.###,1)

Will the round function output depend on 2nd digit after decimal point also or not?

View 6 Replies View Related

SQL & PL/SQL :: Repeated Volume Value Should Become 0?

Jun 3, 2013

I have a query in oracle report in which i am getting this output.Manager Arnav have 2 employees Inder and kaushal whose salary is 10000 and 20000 respectively,

And another manager is Anjali whose employees are Kavya and inder whose salary is 40000 and 10000 respectively .as Inder is repeated I want the salary become 0 in place of 10000 second time.I am in dilemma,What should i do ,if i want to change 10000 to 0
Manager employee salary
Arnav Tiwari Inder 10000
kaushal 20000
Anjali Kavya 40000
Inder 10000[/b]

What should i do in the formula of salary.according to employee name .means if Name exists already then salary value should be 0 and if it comes for the 1st time then its actual value i.e 10000 should be printed.

View 1 Replies View Related

SQL & PL/SQL :: Count Of Repeated Words In A Column?

Mar 1, 2012

I have a table with the following column and data is like this.

SQL>CREATE TABLE test (
column1 varchar2(50));
SQL>INSERT INTO test VALUES('ABC XYZ');
SQL>INSERT INTO test VALUES('MNO PQR');
SQL>INSERT INTO test VALUES('ABCD ABC');
SQL>INSERT INTO test VALUES('PQR MNOP');

[code]....

View 13 Replies View Related

SQL & PL/SQL :: Do Not Accept Punctuation Character While Inserting

Jul 11, 2013

I am learning Regular expression I am solving one problem with regular expression. I am creating a table while inserting I have to restrict punctuation character.

create table emp
(
ename varchar2(30) ,
constraint ck_ename check ( regexp_like (ename , '[^[:punct:]]')));

and also how I can remove double space.

View 8 Replies View Related

SQL & PL/SQL :: Count Repeated Characters In String

Mar 9, 2011

Is there any function to count number of specific character inside string. For example :

my string is 'ABCEF AYZA'

I want to calculate how many 'A' exist in my string. result should be = 3

View 17 Replies View Related

Select From Two Tables - Remove Repeated Rows

May 31, 2011

I have two tables one source table and one destination . Column names and data types of both table are same.

source table (source)

ID NAME
1 aa
2 bb
3 cc
. ...
. ..
. ..

destination Table(dest)

ID NAME
1 aa
2 bb

I need destination table like

destination table
ID NAME
1 aa
2 bb
3 cc
. .....
. ....

I want to remove repeated rows

View 2 Replies View Related

SQL & PL/SQL :: How To Deduct Repeated Values In Crystal Report

Dec 17, 2011

In my report I'm using inner join in queries .I got correct record but itz repeated.How to deduct that repeat values?

this is my query:

SELECT f.feeid,
f.studentid,
( s.first_name + last_name )AS studentname,
b.branchname,
c.coursename,
y.yearname,

[Code].....

View 7 Replies View Related

Reports & Discoverer :: How To Accept Parameter Between Two Report

Jul 20, 2012

I am running rep_1, and before executing second rep_2 the user should enter department number, after accepting department no, the second rep_2 should be executed. But after accepting parameter the second rep_2 is not displaying any record.

View 1 Replies View Related

PL/SQL :: Output Parameter Does Not Accept Formatted Column Value

Nov 21, 2012

Here's my table structure:

<h4><font color="Blue">CREATE TABLE "SSPFUSER05"."PERSONS"
(     SSN NUMBER(13,0),
PIN VARCHAR2(7 BYTE)
);</font>
</h4>

And here's my procedure below:

<h4><font color="Blue">
CREATE OR REPLACE
PROCEDURE SP_SSN_BY_PIN(
V_REQUESTEDPIN IN VARCHAR2,
V_SSN OUT CHAR)
AS
BEGIN
SELECT

[code]....

As you can see the type of the SSN column is NUMBER(13,0). But I leftpad it with 0 and assign it to my output paramter V_SSN, whose type is CHAR. But I get 111196100099 instead of 0111196100099. I've tried TO_CHAR(LPAD(SSN,13,'0')) but still doesn't work. However, if I return the left padded SSN inside a SYS_REFCURSOR I get what I want.

View 1 Replies View Related

SQL & PL/SQL :: REGEXP Digit Extraction?

Oct 25, 2011

I am trying to write a pattern that will return multiple numbers when it finds the string "My String" in a Text such as

Text String:
My String 5 Test Need a good regExp 34 to test multiple 12334 occurrences of the same 566 search string My String 3 hopefully this time My String 7 with three of these'

Expected Output:
5
3
7

I managed to write Regular expression that returns only for the first match as shown below.

select TO_NUMBER(REGEXP_SUBSTR(REGEXP_SUBSTR (vSearchText1, ('My String' d+')), 'd+'))

View 30 Replies View Related

SQL & PL/SQL :: Query To Display Repeated Column Values As Null?

Dec 13, 2012

I have table with the values as below.

C1C2C3C4
NAMEJOHN10ABC
NAMESMITH30DEF
NAMEROBERT60XYZ

I dont want to print the repeated value(NAME) of C1 multiple times as below.

C1C2C3C4
NAMEJOHN10ABC
SMITH30DEF
ROBERT60XYZ

I could do it using the below query using union with the rownum.

select * from (
select rownum rn, c1,c2,c3,c4 from table_new
) where rn =1
union
select * from (
select rownum rn, decode(c1,null,null),c2,c3,c4 from table_new
) where rn between 2 and 3

Is there any other way of displaying using a single sql query.

View 17 Replies View Related

SQL & PL/SQL :: Revised Procedure Pass_ref_cur So That It Can Accept Multiple Columns?

Oct 25, 2011

i was asked to built a report file that will run from oracle form using web. show_document() built-in object to produce a data extract. the objective is to built a dynamic SQL and use that to a cursor.

CREATE OR REPLACE PROCEDURE pass_ref_cur(p_cursor SYS_REFCURSOR) IS
TYPE array_t IS TABLE OF VARCHAR2(4000)
INDEX BY BINARY_INTEGER;
rec_array array_t;
BEGIN
FETCH p_cursor BULK COLLECT INTO rec_array;
FOR i IN rec_array.FIRST .. rec_array.LAST
LOOP
dbms_output.put_line(rec_array(i));
END LOOP;
END pass_ref_cur;
[code]....

I found out that the procedure can only accepts a single column. When I run this code it works fine because I am using a single column on the SQL statement.

DECLARE
rec_array SYS_REFCURSOR;
BEGIN
open rec_array For 'select p.muni from chips.project p, chips.proj_type pt where p.type = pt.id';
pass_ref_cur(rec_array);
CLOSE rec_array;
END;

The objective is to use a multiple column. How can I revised the procedure pass_ref_cur so that it can accept multiple columns?

View 17 Replies View Related

SQL & PL/SQL :: Procedure To Accept Schema And Produce CSV File For Table

Mar 23, 2012

The Utility should have a procedure that will be able to accept a schema and table name and produce CSV file for that table.

This is what i have so far:

CREATE OR REPLACE Procedure print_table (schema_name varchar2, tab_name varchar2) IS
BEGIN--begin procedure
DECLARE
vpath varchar2(100) := 'C:UsersUserDocumentsDocsDBAProject';
[code].....

It works outside of the procedure but the nature of the question requires a stored procedure.

View 26 Replies View Related

SQL & PL/SQL :: Dynamic Cursor / Loop Will Accept Table Name From Parameter

Oct 11, 2013

I have a plsql block construct where i want to use for loop dynamically , the query which for cursor for for loop will accept the table name from parameter and join them to return the result. the resultant data will iterate in loop and do the execution.

DECLARE
--initialize variables here
v_date varchar2(10);
v_rebuild_index varchar2(250);
v_sql VARCHAR2(250);
p_table_name varchar2(250) := 'DS_ABSENCE';
p_source_table varchar2(30) := 'STG_ABSENCE';
p_source_owner varchar2(30) := 'STG_SAP';
v_for_sql varchar2(1000);
[code]....

View 7 Replies View Related

SQL & PL/SQL :: Accept Input And Output To Screen - Getting ORA-06550 Error

Jan 18, 2011

I am trying to accept three numbers and one string as input, and then display the values on the screen. I don't understand why I am getting these errors.

SQL> SET SERVEROUTPUT ON
SQL> DECLARE
2 id_number NUMBER := &id_number_input;
3 trans_num NUMBER := &trans_num_input;
4 remar VARCHAR2(75) := &remark_input;
5 receipt NUMBER := &receipt_input;

[Code] .....

ERROR at line 4:
ORA-06550: line 4, column 24:
PLS-00201: identifier 'HELLO' must be declared
ORA-06550: line 4, column 8:
PL/SQL: Item ignored
ORA-06550: line 10, column 61:
PLS-00320: the declaration of the type of this expression is incomplete or
malformed
ORA-06550: line 10, column 2:
PL/SQL: Statement ignored

View 3 Replies View Related

SQL & PL/SQL :: Function That Multiply Number When There Is More Than 3 Decimal Point?

Mar 20, 2010

how to create a function that will multiply the number when the number has more than 3 decimal point.

Example.
123.012 - multiply by 10
123.0123 - multiply by 100
123.01234 - miltiply by 1000

Column A is the result of the number being multiplied according to decimal point.
Column B contains the multiplier used in column A.

View 10 Replies View Related

(number Precision Too Large) Using POWER (n / M) Function?

Feb 14, 2012

POWER(47.3616, 27.1261) returns: 2.80403309600359E45 which causes "number precision too large" error in my variable which is defined as NUMBER(20,20).

I've tried ROUNDing and TRUNCing the product, but still get the same long output. The only thing that seems to work is SUBSTR.

Is that the ONLY way to deal with this? It seems like there would be a better way or is there another type I should use these super long decimal results?

SQL> SELECT POWER(47.3616, 27.1261) AS Exp_Val
2 FROM dual;
EXP_VAL
----------
2.8040E+45
SQL>

[code].....

View 2 Replies View Related

SQL & PL/SQL :: Creating Store Procedure That Will Accept A Username From A Flat File?

Apr 8, 2012

I'm trying to create a store procedure that will accept a username from a flat file but i don't know how to do read file into store procedure.

Below is a sample store procedure by itself i created to add user which created okay but when i execute I got the error displayed below.

create or replace procedure addUsers(userNam in varchar2)
is
begin
EXECUTE IMMEDIATE 'CREATE USER'||userNam||'IDENTIFIED BY "pass1234" DEFAULT TABLESPACE USERS'||'QUOTA "1M" ON USERS'||
'PASSWORD EXPIRE';
end addUsers;
/

[code].....

View 21 Replies View Related

SQL & PL/SQL :: Split String Function For Large Number Of Records?

Aug 6, 2010

I have created a function that is used for splitting a comma separated string & give the output in tabular form.here is the function

Here I have used CLOB as my input string will be huge(greater than max limit of varchar2)

CREATE OR REPLACE TYPE SPLIT_TBL_CLOB AS TABLE OF CLOB;
CREATE OR REPLACE FUNCTION CSVTOSTRING_CLOB
(
P_LIST CLOB,
P_DEL VARCHAR2 := ','
) RETURN SPLIT_TBL_CLOB PIPELINED

[code]....

But here I am facing 2 problems.

1. The function is not accepting a large string & I am getting the error

ORA-01704: string literal too long

2. The function is going for an infinite loop.

View 10 Replies View Related

PL/SQL :: Assign Number To Row Based On Condition Analytic Function

Oct 24, 2013

Oracle 11g databaseidval1val2100a110b120c200a220b 
WITH input AS
(SELECT 1  id

[Code].....

input; Output:idval1val2assigned_number100a0110b0120c2200a0220b1 The dense numbering sequence should be assigned to each row based on id and val1 column. For a given Id, the numbering only starts after val1 > 1 till then the assigned_number will be zero.

View 1 Replies View Related

SQL & PL/SQL :: Check Wether Digit Is Numeric Or Character

Dec 4, 2004

is there in pl/sql a function to check wether a digit is numeric or character like we have in c 'is_numeric() ' or is_digit() functions�

View 6 Replies View Related

Forms :: Oracle Report Excel Output Repeated Header In Each Line?

Nov 24, 2011

After running my report I generate into the file by delimited type and then I save as it by XLS extension.The problem is each row of this excel file has header repeatedly!

View 4 Replies View Related

Forms :: Wrong Number Or Types Of Arguments In Call To Function?

Jul 2, 2013

I wrote function Quantity(p_item_number in varchar2)RETURN NUMBER, i called This function in POST_QUERY ,Error like this "wrong number or type of arguments in call to Quantity", i tried like as " Quantity(p_item_number in varchar2)RETURN NUMBER" , but it gives an error "encounterd the symbol VARCHAR2 when expecting one of the following ( "..

View 6 Replies View Related







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