SQL & PL/SQL :: Concatenate Parameter With A Column In Query

Sep 30, 2010

SELECT OM.ORG_NAME||' Unit - ':p_unit name
FROM org_mst om

In the above query I want to concatenate Unit number passed by a parameter.

View 4 Replies


ADVERTISEMENT

PL/SQL :: How To Concatenate Quote To Procedure Parameter Input Value

Dec 6, 2012

create or replace procedure ab(a in varchar2, b in varchar2)
is
test varcha2(8);
begin
if (a is not null) then
for i in(select c
from t
where c between ||'''||a||'''|| and ||'''||b||'''||)
loop
test:=i.c
end loop;
end if;
end;

I want both parameter input values to be enclosed in quotes so that it considers both parameter values as char.Receiving ora 00936 missing expression error.

View 7 Replies View Related

SQL & PL/SQL :: How To Concatenate Column

Jul 26, 2012

I have the following info in a table:

LEVELPARENTPOSCHILD
1100571010055
1100572010053
2100552010056
2100551010054

The output that I need is:

LEVELPARENTPOSCHILD
1100571010055
21005510.1010054
21005510.2010056
1100572010053

If there are even more levels, I also need those childs to be shown right below their parent and with POS as 10.20.10 )(for the first item below POS 10.20.

View 4 Replies View Related

SQL & PL/SQL :: Column Name As Parameter

Feb 9, 2012

From ETL tool i will be passing two parameters to a procedure. I want to know whether this parameter can be used in a select statement of a correlated query.

Query to be in the procedure :

begin
update table1 set table1.col1 = (select parameter2 from
table2 where table2.x = table1.x and table2.x = parameter1) ;
commit;
end;

parameter2 will be having the columnname to be passed. And everytime different columnname will be passed to this procedure.

View 16 Replies View Related

SQL & PL/SQL :: Sub Query Using Outer Parameter?

Apr 10, 2010

How to give table1 column to subquery with table2 :
(select t1.*, sq.*

from table1 t1,
(select a,b,c from table2 where col1= t1.col1) sq
where ...

View 4 Replies View Related

SQL & PL/SQL :: Procedure Parameter From Database Column

Feb 7, 2011

I knew procedure can be run like 'EXEC (****);' and can be written like

'Create or replace procedure(**** IN VARCHAR2)

BEGIN
END
/

But the requirements are 'Parameter can be come from referencing DB table column?')

If table has value like PARMTAG PARMVAL, I read LOGSTORETYPE data and if exist, fetch the PARMVAL value 7 to my parameter? LOGSTORETYPE 7

Is it possible?

The reason is batch process was written by ProC and DB upgrade time with exadata, we want to change batch to Procedure about our DB delete.

View 2 Replies View Related

SQL & PL/SQL :: Lexical Parameter Slow Down Query?

Feb 16, 2010

All my following query is running fine.

SELECT pd,
vr_date,
x.vr_no,
vr_sn,
cac,
ac,
nar,

[code]....

but problem is that when above query is used or oracle reports then and lexical parameter is used then i slows down more than 100 times

SELECT pd,
vr_date,
x.vr_no,
vr_sn,
cac,

[code]....

above query is copy of top query but differnce is that &P_Unt_Cls lexical parameter is used instead of and Unit in(29,34,35,36,37,38,44,45,60,70,71), I am unable to understand why it slow down query.

View 6 Replies View Related

Any Query Timeout Parameter In Oracle?

Oct 2, 2013

Is there any timeout for sql queries in oracle,  if so what is the timeout parameter.

View 3 Replies View Related

SQL & PL/SQL :: Ref Cursor As In Parameter / How To Fetch Column Values

Sep 21, 2010

i have a proc that is taking p_serial_number refsursor as in parameter. the structure of p_serial_number is required to be

mfg_prod_cdchar (3 byte)
mfg_prod_seq_no char (6 byte)

How do I need to define this ref cursor ? and when I use it in my Procedure how do I fetch the column values ?

View 6 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

Pivot Query In Oracle To Get Years From Column And Make Separate Column For Each

Jul 22, 2009

I'm trying to do a pivot query in oracle to get the years from a column and make a separate column for each. I found an example of the code to use on the internet and i changed it for my own tables but i'm getting errors. Namely a "FROM keyword not where expected" error at the beginning of the 'avg(...' statements.

I have copied the code used in

select stud_id, 2006, 2007, 2008, 2009
from (
select stud_id,
avg(case when year=2006 then ((present/poss)*100) else null end) 2006,
avg(case when year=2007 then ((present/poss)*100) else null end) 2007,
avg(case when year=2008 then ((present/poss)*100) else null end) 2008,
avg(case when year=2009 then ((present/poss)*100) else null end) 2009
from attendance.vw_all_attendance_perc
group by stud_id
);

View 11 Replies View Related

SQL & PL/SQL :: Column Access In Table Based On User Parameter Input

Nov 10, 2010

Need to access data in a table base on user parameter input where the data is stored like a spreadsheet with column headings JAN, FEB, MAR... and the rows are the years. Is there a way to create a generic SQL statement so that I don't have to have 12 if statements in the procedure?

View 5 Replies View Related

PL/SQL :: How To Pass List Of Values In Where Clause Of Query Parameter

Sep 18, 2012

I need to get multiple code values and put it into a variable which later need to pass into the where clause of an sql. But i am not getting any results even i pass those values in the variable of an where clause: below is my Procedure:

declare
TYPE crMain_record is RECORD (
v_code             dummy.v_code%type,
n_no               dummy.n_no%type,

[Code].....

END;"lv_character" is going to hold the multiple code values which i need to pass into whare clause of the above SQL: the totlal number of these mulitipe codes can be more then 50..

And lv_character values are commung from a setup table
lv_character varchar2(32767):= '('||''''||'COMMIS'||''''||' , '||''''||'AGY BUILDING BENS'||''''||')';
--And lv_character values are commung from a setup table.where "lv_character" holdes multipe code values...
And lv_character values are commung from a setup table and upper(d.v_code)in lv_characterif the

View 3 Replies View Related

Export/Import/SQL Loader :: Query Parameter And Partitions

Nov 28, 2012

Version : 11.2.0.3

EMP_DTL table is a subpartitioned table (Range partitioned by MonthID and subpartitioned by COUNTYR_CODE).

It has 40 million records. I just wanted to export 100,000 records altogeter from all partitions for testing purpose.

But when I ran the below expdp with QUERY , it was exporting 100,000 records from each subpartition of the table !!

expdp "'/ as sysdba'" tables = HRTB_CMBH.EMP_DTL dumpfile=EMP_DTL_BKP.dmp DIRECTORY= DATA_PMP1 QUERY=HRTB_CMBH.EMP_DTL:"where rownum < 100001" LOGFILE= exp-partitionedTable.log The log

Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "HRTB_CMBH"."EMP_DTL":"TCO_201205"."TCO_201205_IND"  38.48 MB  100000 rows
. . exported "HRTB_CMBH"."EMP_DTL":"TCO_201206"."TCO_201206_IND"  42.51 MB  100000 rows
. . exported "HRTB_CMBH"."EMP_DTL":"TCO_201205"."TCO_201205_HKG"  31.28 MB  100000 rows
. . exported "HRTB_CMBH"."EMP_DTL":"TCO_201206"."TCO_201206_HKG"  32.97 MB  100000 rows

[Code]....

This is not mentioned in the Utitilies document. Is this expected behaviour ?

View 2 Replies View Related

Application Express :: Column Link Where Column Number Changes With Query

Feb 11, 2013

We are using Oracle 11g with Apex 3.2 on AIX. We are reporting data from customer satisfaction surveys. I'm using the following sql to create my report

<code>select * from(
select month,'Overall Satisfaction' as q_group, 1 as srt,Overall Satisfaction,site,
case when count(*) < 31 then '*' else
round((sum(ttos)/count(*))*100,0)||'/'|round((sum(bfos)/count(*))*100,0)||'/'||count(*) end ospct
from v_XXX_report a,(select distinct month_dt month from v_XXX_report) b
where Overall_Satisfaction is not null and year_dt = 2012

[Code]....

The problem is that site is not allways present and sometimes I have other variables in addition to site. This creates a situation where the month columns will not allways appear at the same column number. For example, When I run this query as is then the "JAN" column is Col3 (first column is a break, col2 is not shown). When I run this query without site then "JAN" is the second column. I would like to create column links for the "JAN" - "DEC" columns but not for any other columns.

Another issue - in the column link creation screen I can create up to 3 variables that I can pass to the next page. Since my query is a pivot I'm uncertain how to pass the column heading or the row value (for col2)

ie
Overall Satisfaction JAN FEB MAR APR MAY ...
Overall Satisfaction 12/12/200 12/12/210 12/12/220 12/12/230 12/12/240...
Recommend 12/12/200 12/12/210 12/12/220 12/12/230 12/12/240...
etc.

So if I clicked on the values at Recommend:FEB how can I get "Recommend" and "FEB" into variables that I can use on the next page? I've tried #column_name#, #month#, #q_name# and #APEX_APPLICATION.G_F10# but no luck.

View 0 Replies View Related

SQL & PL/SQL :: Using Varchar Parameter In Queries With Number Column Can Result In Performance Degrade

Jul 4, 2013

I would like to know if using varchar parameter in sql queries with number column can result in performance degrade.

Ex: Procedure testa ( myparam varchar) is
begin
select col1 into var1 from table where colno = myparam;
end;

Here col no is a number column and myparam is varchar. I feel its better to change the parameter to number.

View 7 Replies View Related

Server Utilities :: Syntax Error In Using Query Parameter In Expdp

Aug 17, 2013

I want to take an export of table MESSAGE, and filter it for the day of 17 JUL 2013 (just to limit the size). i used the following expdp command but its not working.

expdp SYSTEM directory=DATA_PUMP_DIR dumpfile=DB_16_08_2013.dmp logfile=FA0001P_BG_16_08_2013.log TABLES=schema.MESSAGE QUERY=schema.MESSAGE:where created_on between to_date('17-July-13 00:00:00','DD-Mon-YY hh24:MI:SS') and to_date('17-July-13 23:59:00','DD-Mon-YY hh24:MI:SS')

But with select query i am able to retrieve the rows for the specific date.

select * from MESSAGE where created_on between to_date('17-July-13 00:00:00','DD-Mon-YY hh24:MI:SS') and to_date('17-July-13 23:59:00','DD-Mon-YY hh24:MI:SS')
Here is the command with syntax error.
[oracle@orcl log]$ expdp SYSTEM directory=DATA_PUMP_DIR dumpfile=DB_16_08_2013.dmp logfile= DB_16_08_2013.log TABLES=schema.MESSAGE QUERY=schema.MESSAGE:where created_on between to_date('17-July-13 00:00:00','DD-Mon-YY hh24:MI:SS') and to_date('17-July-13 23:59:00','DD-Mon-YY hh24:MI:SS')
-bash: syntax error near unexpected token `('

View 3 Replies View Related

Application Express :: 4.2 - How To Pass Date Picker Parameter Into Query

Aug 19, 2013

steps to achieve this report I need a Date Column on top of the page Depending on the selected date, Result should be displayed below for e.g. 

suppose i select a date as 14-aug-2013

Enter Report Date ___________________ ( Date Picker)  Location Name      Report Date        Quantity           valueXYS                       14/08/2013          5000            1200000ABCD                     14/08/2013          2000                24000-------------------------------------------------------------------------------------------------TOTAL                                              7000            1224000 

View 9 Replies View Related

SQL Concatenate Using A Loop

Feb 17, 2010

I have a table which I will call 'fruit basket' which contains the following data:

basket_ref, fruit, fruit_serial
1, apple, 1
1, banana, 2
1, pear, 3
2, apple, 1
2, lemon, 2

What I want to produce is a table in the following format

basket_ref, all_fruit
1, apple banana pear
2, apple lemon

There could theoretically be any amount of fruit in a given basket, so I will need to set up some kind of loop in order to read each record from the original table. I am not sure how it would be best to do this.

View 2 Replies View Related

SQL & PL/SQL :: How To Concatenate Three Columns Into One

Feb 21, 2012

I'd like to concatenate my 3 columns into one. I have this text item(NAME) and i want my columns lname, fname and mname to be bound into name text item.

this is so far my code to do the concat:

SELECT lname
INTO :ADVISEMENT.name
FROM students
WHERE :ADVISEMENT.name = lname || ',' || fname || ',' || mname;

but it didn't appear at all.

View 17 Replies View Related

Server Utilities :: Query Parameter - Export Subset Of Table Using RowID

Aug 15, 2012

I am exporting using query parameter. I am trying to export subset of table using rowid.

SQL> select rowid , name from tab1;

ROWID NAME
------------------ ---------------
AAAM0rAAEAAAAGMAAA sam
AAAM0rAAEAAAAGMAAB sona
AAAM0rAAEAAAAGMAAC rose
AAAM0rAAEAAAAGMAAD chris
AAAM0rAAEAAAAGMAAE san
.................. ....
.................. ....

command given as

exp sam/sam tables=tab1 file=exprwid.dmp query="where ROWID='AAAM0rAAEAAAAGMAAA'" log=log1.log

Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8ISO8859P1 character set (possible charset conversion)

About to export specified tables via Conventional Path ...
. . exporting table TAB1
EXP-00056: ORACLE error 911 encountered
ORA-00911: invalid character
Export terminated successfully with warnings.

how can i export this record ?

View 4 Replies View Related

How To Concatenate A String With Variable

Mar 5, 2008

I am trying to replace the string_name in the following execute immediate statement with a concatenated

string_||v_variable.

execute immediate
'select
table_name
from
user_tables
where table_name = :a'
into v_table
using 'string_name';

I tried different declaration and concatenations but nothing worked so far.

View 2 Replies View Related

SQL & PL/SQL :: How To Concatenate While Removing Nulls

Jan 26, 2012

This is a simple question, but I cannot seem to find a solution. Here's the basic query:

select distinct accountno, parcelno, streetno||' '|| predirection ||' '|| streetname||' '|| streettype||' '|| postdirection||' '|| unitname||', '|| propertycity
from tblacctpropertyaddress ....

What I want to do is add is this logic: If Predirection is null, then no space between streetno & streetname. Same for postdirection and unitname. (for example, if both postdirection and unitname are null, there are no spaces between streettype and the comma before propertycity)

Also, when unitname is not null, I want to add the string "Unit " prior to the returned value in unitname.

View 5 Replies View Related

SQL & PL/SQL :: Concatenate String In Function?

Jul 29, 2010

i m create one function in which i have to concatenate result likeDate is 19/07/2010'. i tried to concatenate in select statement. in this case function is created successfully but it gives error when it run.

CREATE or replace function TEST(FINYEAR VARCHAR2)
RETURN VARCHAR2 AS
QRY_STRING VARCHAR2(1000);
BALANCE VARCHAR2(100);

[code]...

ERROR at line 1:
ORA-00923: FROM keyword not found where expected
ORA-06512: at "TEST", line 11

View 19 Replies View Related

Application Express :: Dynamic Reports - Runtime Parameter Passing To Report Query

Jul 27, 2013

I have developed a report using apex shared components (report query and report layout) along with BI Publisher for report printing in pdf format. the Report template is built using Template Builder for Word. I have configured my Apex4.1 env with BI Publisher 11. This report is working fine for hardecode ID ( like REQUEST_ID=10 ).  to make report dynamic i have made following additions in the report 

I have added where clause in report query as WHERE REQUEST_ID = :REQUEST_ID (:REQUEST_ID is the text field in my page).

Added a text field names :REQUEST_ID to get user input at run time.

Create a button and add Repot Query URL in its properties. When i run the report with some valid value in :REQUEST_ID text field  i did not get expected result infect there is no record getting displayed in the PDF file. i think this is not the write way to do this but interestingly im not getting any error. how can i get this functionality in apex this way or the other ?

View 0 Replies View Related

Forms :: Concatenate Or Copy Value On Enter Or WVI

May 27, 2013

I have three database fields on my form , field_1 , field_2 and field_3 , user will enter the data in field_1 , and sometime he may not enter in field_2 ,

I want to bring the value of field_1 as it is into field_3 if he does not enter anything in field_2, if he enters the data in field_2 , then field_1 will get concatenated with field_2 and gets copied into field_3.Is there a way to do this automatically at form level using a trigger when-validate-item.In short this should be done after user presses the enter key on field_2.

create table ot_Sale_code_head ( sale_code varchar2(12),code1 varchar2(6),code2 varchar(6),code3 varchar2(12));
insert into ot_Sale_code_head ('A','01.01',NULL,NULL);
--inserted record in form will be 'A','01.01',NULL,'01.01'
insert into ot_Sale_code_head ('B','01.01','PS-P',NULL);
--inserted record in form will be 'B','01.01','PS-P','01.01.PS-P'

View 2 Replies View Related

Server Utilities :: How To Concatenate 2 Fields

Aug 19, 2010

I am running SQLLDR on unix.

LOAD DATA
INFILE F56100c.dat
APPEND
INTO TABLE tstdta.F56100C
(
Z59SFU13 POSITION(14;21),

[Code]...

I have already used

1.Z59SFU17 POSITION(55:59)||POSITION(51:53)||POSITION(47:49) getting err:Illegal combination of non-alphanumeric characters

2.Z59SFU17 POSITION(55:59,51:53,47:49) this is also not working.

3. i can not use ":Z59SFU15 || :Z59SFU16" this option.

View 6 Replies View Related

SQL & PL/SQL :: To Remove Duplicates From Concatenate String

May 12, 2011

I have a query like

SELECT country_name,
substr(SYS_CONNECT_BY_PATH(product_name,','),2) as PRODUCT_NAME,
substr(SYS_CONNECT_BY_PATH(SPEED_VALUE,','),2) as SPEED_VALUE,
substr(SYS_CONNECT_BY_PATH(i.SUPPLIERNAME_ACCESSPROTYPE,','),2) as SUPPLIERNAME_ACCESSPROTYPE
FROM (SELECT b.country_name,b.product_name,b.speed_value,(supplier_name|| supplier_product || access_product_type)as
[code].......

In the result , I am getting repeated values for product_name and speed value,something like 'ALL Products,All Products,All Products'in the product_name column and '128Kbps,128Kbps'in Speed_vale.i am not able to remove the repeated values here.

View 2 Replies View Related

SQL & PL/SQL :: Concatenate A Comma But Not Single Quotes

Oct 8, 2010

In table_A , the primary key is Col_A which is of data type number.I want to concatenate it with ' '

Col_A
______

123
124

select '|| col_A ||'||','
from
Table_A;

The output should be
'123',
'124'

I can concatenate a comma but not single quotes.

View 3 Replies View Related

PL/SQL :: To Concatenate Last_name And First_name Fields With A Space In Between

Mar 19, 2013

I'm a fledgeling to start of with databases. Query below :

Select CONCAT(last_name,'',first_name)
from employees

When I run this query in SQL developer, I'm getting the following error :

ORA-00909: invalid number of arguments
+00909. 00000 - "invalid number of arguments"+

The aim is to concatenate last_name and first_name fields with a space in between.

View 4 Replies View Related







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