SQL & PL/SQL :: How To Pass Operators Dynamically

Dec 8, 2010

i am trying to pass operators dynamically.

SQL> create table test(Amount number,Name varchar2(10));
Table created.
SQL> insert into test values(100,'USA');
1 row created.
SQL> insert into test values(150,'NEWYORK');
1 row created.
SQL> insert into test values(200,'SCOTT');

[code].....

I would like to pass the operators from another table. How to pass the operators from other table.

View 8 Replies


ADVERTISEMENT

SQL & PL/SQL :: How To Pass Date Condition Dynamically

Dec 27, 2012

I have the following control table.

ID S_OWNER SOURCE_TABLE A_OWNER ARC_TABLE CONDITION_COLUMN PERIOD_VALUE PERIOD_UNIT

1 wedb Auction_table wedb Arc_Auction_tableAuction_date 15 Days
1 wedb Sales_table wedb ArcSales_table Sales_date 180 Days
1 hr Accounts_table hr Arc_Accounts_tableAccount_date 2 Years
2 concor Concur_table con Arc_Concur_table Last_update_date 4 Months

Like this 1000 entries are there in the control_table.

I want to pass all the columns from my control table dynamically.I am able to pass all the columns dynamically,except the PERIOD_VALUE.I have stucked up how to implement this condition.My aim is to get the data which is <= sysdate-PERIOD_VALUES based on PERIOD_UNIT.

For Example:

For Auction_date column I want to get the data which 15 days old.
For Sales_date column I want to get the data which 180 days old.
For Account_date column I want to get the data which 2 yers old.
For Last_update_date column I want to get the data which 4 months old.
[code]....

View 12 Replies View Related

SQL & PL/SQL :: How To Pass Different Number Of Columns Dynamically To A Query

Apr 26, 2010

I want to pass Number of columns dynamically to a query. I got success in SQL.

SQL> select &column_list from emp;
Enter value for column_list: empno,ename,sal

EMPNO ENAME SAL
---------- ---------- ----------
7369 SMITH 800
7499 ALLEN 1600
7521 WARD 1250
7566 JONES 2975
7654 MARTIN 1250
7698 BLAKE 2850
7782 CLARK 2450
7788 SCOTT 3000
7839 KING 5000
7844 TURNER 1500
7876 ADAMS 1100
7900 JAMES 950
7902 FORD 3000
7934 MILLER 1300

14 rows selected.

But the same i need to achieve in pl/sql. I try with the Ref cursor, but not succeeded.

View 15 Replies View Related

PL/SQL :: Relational Operators Without Between Clause

Jun 19, 2013

I have below query which uses between clause. For some constraints I cannot use between clause so this need this to converted to use only relational operator.

select * from TABLE1
where "+ width +" between start_width " +  "and end_width and "+ height +" between start_height " +  "and end_height " +  "and id = "+ id

View 2 Replies View Related

Difference Between NOT IN - MINUS - NOT EXISTS / EXCEPT Operators?

Nov 19, 2011

where difference lies between these operators or clause, & whether there is any "except" operator in oracle, i know other three are used bt dont think oracle uses "except" too..as far as i have seen "NOT IN", "MINUS" , "NOT EXISTS" are exactly similar?

View 4 Replies View Related

PL/SQL :: Separate Different Arithmetic Operators In A Query?

May 14, 2013

I wrote an query and regarding one part, i have syntax problem, when should we seperate different arithmetic operators in a query?

for example

select  density_with_desert.popp  /  density_with_desert.arr  -  sum(darea)  from counytyi don't want to use variables.

View 8 Replies View Related

Get Data Dynamically In Sql

Dec 3, 2012

below SQL I'm pulling data manually(by entering specialist name) instead of that I want this query to be modified so that the sys is pulled dynamically, I.e. like select specialist from t.

CODESELECT
type, Hari,Rakesh,Santhosh, Total
FROM (
select
(type), max( decode( SPECIALIST, 'Hari', cnt, null ) ) Hari,
max( decode( SPECIALIST, 'Rakesh', cnt, null ) ) Rakesh,
max( decode( SPECIALIST, 'Santhosh', cnt, null ) ) Santhosh,
Sum(cnt) total
from (
select

[Code]...

View 1 Replies View Related

PL/SQL :: Pass Value To If Condition?

Oct 31, 2012

I want to run multiple sql select command after loggin to sqlplus and need to pass the value to variable to check the condition.

When I am running the below script I am getting the below error
----------------------
SP2-0734: unknown command beginning "return :va..." - rest of line ignored.
SP2-0734: unknown command beginning "return :va..." - rest of line ignored.

a2.sh: test: argument expected
------------------------

Example:
sqlplus -s system/SYSTEM_PASS << EOF
set pages 0
set head off

[Code].....

View 5 Replies View Related

Forms :: Dynamically Add Value In Combo Box?

Feb 17, 2010

I have created one form using oracle ids. i want add value into combo box in runtime.

View 3 Replies View Related

PL/SQL :: Add Zeros Dynamically After A Number?

Sep 15, 2013

I want to add number of zeros after a number dynamically. eg: If number is 2 and number of zeroes to be added is 5 then final output should be 200000;

View 12 Replies View Related

PL/SQL :: Get Columns Name And Value Dynamically From Trigger

Jul 9, 2013

I have to audit some table to log all modifications (inserts, updates, deletes). I wrote the following trigger (works as expected) : 

-- Trigger for DOCUMENT table audit
CREATE OR REPLACE TRIGGER TAUDIT_IUD_DOCUMENT
AFTER INSERT OR UPDATE OR DELETE ON DOCUMENT
FOR EACH ROW
DECLARE
l_user VARCHAR2(64);
[code].........   

Is there any way I can improve this ?I mean getting columns name and value (:NEW and :OLD) dynamically, instead of specifying them one by one (the trigger will have to be updated in case a new column is added). Something like this : 

FOR i in 1..DOCUMENT.COLUMN_COUNT LOOP
l_row := l_row || DOCUMENT.COLUMN_NAME(i) || :NEW.COLUMN_VALUE(i) || l_separator;
END LOOP; 

View 6 Replies View Related

Forms :: Display A Value Dynamically

Jun 17, 2013

In alters I want to display a value dynamically.

like when deptno=10 came then it should dynamically displays the message like Department 10''.

when deptno=20 came then it should dynamically displays the message like Department 20''. and.....

View 4 Replies View Related

Create Table Dynamically

Oct 14, 2011

In a pl/sql procedure code, I created a normal table (create table) using dynamic sql. Then I used that table in procedure for further processing. But while compiling, it gave error that table does not exist. I can understand that he table is not present in DB, so the error came. But at the same time I need to create a table dynamically, use it and drop it. Does it mean that I need to make every query referencing that table as dynamic ??

View 1 Replies View Related

SQL & PL/SQL :: How To Pass Parameter In A View

Nov 16, 2012

How to pass parameter in a view.

create or replace view spic_bags as
select distinct(a.item_code) Material_Code,a.uom,
(case when a.card_code = '60' then
case when a.ccn <> '091' then
[code]........

in this above view i have hardcoded dates, well how to pass parameter for this view without hardcoding? here i need to pass the date as a parameter from a select query to view the data from the above view!

View 4 Replies View Related

SQL & PL/SQL :: Pass Table Name To Cursor?

Dec 16, 2010

I want pass the tablename to cursor. The tablename will be a dyanamic one, as we have the data in different sources tables[multiple systems - all systems will provide the data dump to oracle] with same set of columns.

I have inserted all the tablenames in a parameter table and based on conditions daat should be fethced from each system.

I need to pass the tablename to the cursor to fetech the coloumn list from the table(the table that is passed as parametr).

View 3 Replies View Related

SQL & PL/SQL :: Pass Date Parameter

Jun 22, 2010

In a procedure i need to pass date parameter, to check how to do this. I create a simple procedure, but it giving

PLS-00049: Bad Bind Variable 'FD'
PLS-00049: Bad Bind Variable 'TD'

How to resolve .......

CREATE PROCEDURE pass_date_parameter
AS
fd VARCHAR2 (10) DEFAULT '01-01-2010';
td VARCHAR2 (10) DEFAULT '01-06-2010';
ffd VARCHAR2 (10) DEFAULT '01-01-2010';
ttd VARCHAR2 (10) DEFAULT '01-06-2010';

[Code]....

View 19 Replies View Related

SQL & PL/SQL :: How To Pass Timestamp Parameters

Sep 13, 2013

In my task I am trying to pass a timestamp datatype as one of the input parameter to a procedure in the package.But I am not sure how to give data for it while executing and testing it from anonymous block.

CREATE OR REPLACE
PACKAGE body ac
IS
PROCEDURE ac_ex_wbdb_keycats(
In_Sale_Location_Id IN NUMBER,
In_Start_Datatime IN TIMESTAMP,
In_Stop_Datatime IN TIMESTAMP,
v_refcur OUT sys_refcursor)

[code]....

View 2 Replies View Related

SQL & PL/SQL :: Pass The File Into CLOB?

Nov 9, 2012

Is it possible to pass the file into CLOB column in real-time without DIRECTORY in oracle sp. I have not come across but would like to know is there anyway to pass the file directly from .net to oracle.

View 2 Replies View Related

SQL & PL/SQL :: Function To Pass Through Authentication

Oct 24, 2010

I wrote many functions before, but NEVER a function to pass through authentication...Here are some of the specs ...In this example, an institution will be accepting tuition and fee payments against bills that are stored in the our system. In addition to the minimum bill authentication parameters, the institution would like to pass us a full name to display when welcoming the user, control the users primary e-mail address, and restrict the payment method on a per user basis.

URL url This will be issued to you by your project manager. It should be of the form URL....

User Id user_id The unique identifier for the user within the institution. This is typically a student ID. (in our database)

Full Name full_name Users full name. Example "John Smith". (in our database) Email Address email Primary email address. in (our database) Payment Method paymentMethod Payment methods allowed for this user.

Allowed values:
"none" :no payments accepted
"ach" :ach is the only accepted
"cc" :credit cards only accepted
"ach_cc" :credit card and ach 16

Key key The shared key that is issued to you by your project manager.Time Zone tz The time zone you are located in. Valid values are:

"E" :Eastern time zone
"C" :Central time zone
"M" :Mountain time zone
"P" :Pacific time zone 1
[code]....

I know I need to have cursor to check on the user_id, full name, email (those values are store in our DATABASE. The URL and the key are giving to me. Do I have to hard code the url in the cursor and stored in a variable so I can check that the url coming in (url in varchar2) is equal to the url in my cursor? The same with the key?

View 2 Replies View Related

Dynamically Executing A Select Command

Aug 4, 2010

How to dynamically execute a select command whether it is retrieved a single record or multiple record in oracle database 10g. i have tried with the command execute immediate but it was not successful.

is it possible can i delete or drop multiple tables in a single drop and delete statement.

View 5 Replies View Related

Execute Immediate To Dynamically Build A Trigger?

Apr 25, 2011

We have developed a code which builds a trigger on a atble dynamically at run time usinf Dynamic SQL command Execute immediate.

create or replace
PROCEDURE GENERATE_TRIGGER
(
P_TNAME IN VARCHAR2

[Code].....

I am not usre if the error is due to insufficient privileges as we are able to build tabl;e in the system dynamically using the above mentioned command.

View 1 Replies View Related

Dynamically Build (recursive) Xml SQL Statement

May 3, 2013

We have an requirement to create xml data for entire database (selected tables) which are in hierarchy.Procedure should read node_mapping table having parent and child tables relationship info and build XML Select statement.

Currently it is building SQL statement whenthere are one parent having multiple childrens i.e Dept having emp, emp_act, emp_rsch..but when child node are having childrens then it is not working - it has to repeatedly call this procedure (recursive) and build below given SQL statement.

1. To change procedure to build xml sql statement when there are multiple childrens to child nodes (hierarchy)
2. To format the output in xml data

We are using ORACLE 11G and WINDOWS 7

CREATE TABLE node_mapping
(
NODE_ID NUMBER(5) PRIMARY KEY,
PARENT_NODE VARCHAR2(100),
CHILD_NODE VARCHAR2(100),
PARENT_NODEID VARCHAR2(50),
CHILD_NODEID VARCHAR2(50)
[code]....

View 1 Replies View Related

Forms :: Dynamically Getting Column Names

Jul 20, 2010

i have list item populated with many table names from a schema. i have grid in oracle forms 10g and i want to fill the grid with at least four/more columns.I want to fire the list change trigger when each time any one table name is selected.

how can i find the columns names dynamically for filling the grid.

View 6 Replies View Related

SQL & PL/SQL :: How To Find Out Time Variance Dynamically

Mar 28, 2012

I wanted to calculate the time variance dynamically as below.I have one table called process_status where we can see the process name, start time, end time and the status .

1. Now i wants to calculate the duration(end_time - start_time) in hh:mi:ss format and i got the output using below query.

select name, start_time, end_time, status, to_char(trunc(sysdate) + (end_time - start_time), 'HH24:MI:SS') duration from process_status ;

I got currect oupput but i am stuggling with the below step.

2). Actually the process expectaiotn time is 2 hours only(fixed time). Now i wants to calculate variance b/w expected time and the duration time(end_time - start_time)

i.e variance = expected_time - (end_time - start_time ) ;
here expected time is 02:00:00(fixed).

I tried using with to_char and to_date function but no luck.

View 7 Replies View Related

Forms :: Populate List Dynamically?

Mar 15, 2013

i want to create the list item dynamically on the when new form instance this is the code....

group_id := create_group_from_query('lst','select (imt.item_id), to_char(imt.item_code, from items_mt imt');
v_num := Populate_group(group_id);
populate_list(v_num,group_id);

but the list is not the populate.

View 14 Replies View Related

SQL & PL/SQL :: Dynamically Build SELECT Statement

May 8, 2013

We have an requirement to build (XML) Select statement dynamically based on the mapping table (which is in hierarchy format)

I have removed xml keyword, so query will not work. but need procedure which will recursively check mapping table (parent and child table) and build below given select statement.

Example 1:
SELECT dname,
(select ename,

[Code]....

View 8 Replies View Related

Forms :: Dynamically Passing Where Condition

Jul 4, 2011

I am working on 6i reports.I have below scenario to achieve.

I have FIND window and MAIN Window.

FIND Window: contains EMPNO, ENAME,and FIND button.

MAIN WINDOW: EMPNO, ENAME, SAL, JOB

If i enter something in FIND window, by clicking FIND button, it will populate data in MAIN window.I have below query in WHEN BUTTON PRESSED TRIGGER.

declare
cursor c1 is select empno, ename, job, sal from emp
where empno=nvl(:FIND.empno,empno)
and ename=nvl(:FIND.ename,ename)

begin
--here i am populating data into MAIN window block
end;

It's working fine.

REQUIREMENT: i want to pass where statement dynamically. Let us say if i pass only empno in FIND window, i want to pass 'WHERE empno=:FIND.empno' to existing select statement [I will keep select statement same without where condition]

If i pass empno and ename both, i want to pass 'WHERE empno=:FIND.empno and ename=:FIND.ename.

How to pass where condition to existing select statement based on parameters we pass in FIND window.

View 8 Replies View Related

SQL & PL/SQL :: Converting Rows To Columns Dynamically?

Oct 20, 2011

I Have a table like this. 12 rows and 8 columns.And column 1 Dt is going to change everytime,as date and months proceeds.and corresponding columns values are going to change.

I want to convert rows to columns dynamically..

DT COL1COL2COL3COL4COL5COL6 COL7
01/01/20111234567
01/02/2011131415161718 20
01/03/2011252627282930 32
01/04/201137383940414201/05/2011495051525354 55
01/06/2011616263646566 67
01/07/2011737475767778 29
01/08/2011858687888990 92
01/09/2011979899100101102 04
01/10/2011109110111112113114 115

i want result like this.

01/01/201101/02/201101/03/201101/04/2011
1 9 11 12
2 11 23 12
3 11 11 11
4
5
6
7
8

View 2 Replies View Related

SQL & PL/SQL :: How To Create Table Replica Dynamically

Oct 22, 2013

i need to create a replica of an existing table in same schema dynamically so as to reflect the modifications on replica table which has been done on primary table.this table we need to maintain as snapshot,like if a column is added or deleted then it should automatically be added or deleted on the replica table.how should i approach this.

View 4 Replies View Related

SQL & PL/SQL :: How To Call Procedure Dynamically Using Execute Immediate

Jan 2, 2011

I have a procedure p1 in schema s1.i want to call this procedure in schema s2 dynamically.how can i do?

View 4 Replies View Related







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