Flashback query with FGAC using Toplink
Hi! All,
I was just wondering whether we could use FGAC (Fine Grained Access control or VPDs) with Flashback queries.
Example: 1) User 1 performs changes to a table on rows that he owns in a DB
2) User 2 performs changes to a different set of rows on the same table that he owns.
3) User 1 does a flash back query to undo his changes.
4) Will user 2's changes be affected by the flashback done by user 1?
Thanks
The problem is the toString() on JGeometry. It does not print out a complete description the database can use inline. It produces:
JGeometry (gtype=1, dim=2, rid=8307
To get JGeometry types to work in your queries the easiest solution is to use parameter binding so the literal representation is not used.
Doug
Similar Messages
-
Please suggest a select query / sub query with out using any subprograms or
source table: Three columns ORIGIN, DESTINATION,MILES
Origin Destination Miles
Sydney Melbourne 1000
Perth Adelaide 3000
Canberra Melbounre 700
Melbourne Sydney 1000
Brisbane Sydney 1000
Perth Darwin 4000
Sydney Brisbane 1000
out put :Three columns ORIGIN, DESTINATION,MILES
Duplicate routes are to be ignored so the output is
Origin Destination Miles
Sydney Melbourne 1000
Perth Adelaide 3000
Canberra Melbounre 700
Brisbane Sydney 1000
Perth Darwin 4000
Please suggest a select query / sub query with out using any subprograms or functions/pkgs to get the out put table.Hi,
user9368047 wrote:
... Please suggest a select query / sub query with out using any subprograms or functions/pkgs to get the out put table.Why? If the most efficient way to get the results you want involves using a function, why wouldn't you use it?
Here's one way, without any functions:
SELECT a.*
FROM source_table a
LEFT OUTER JOIN source_table b ON a.origin = b.destination
AND a.destination = b.origin
AND a.miles = b.miles
WHERE b.origin > a.origin -- Not b.origin > b.origin
OR b.origin IS NULL
;If you'd care to post CREATE TABLE and INSERT statements for your sample data, then I could test this.
Edited by: Frank Kulash on Nov 6, 2012 7:39 PM
Corrected WHERE clause after MLVrown (below) -
Re execute query with out using a time
Hi
I want to refresh data in many based tables blocks automaticly with out using a timer, lest say ever 2 m refresh the data, is there is any soluation for that
best regardsHi!
If you use a timer, the mouse cursor will not move...
But may the content of an active item get selected, if the timer elapse.
This is just happen, if you have a form open with a running timer
and call another form with the open_form build-in.
When the timer in the calling form elapse, a context switch to
the calling form occurs and when the focus come back to the called form,
may the current-item value is getting selected. But the mouse cursor is not moving!
May you try to requery your block with a timer and see what's happen.
Regards -
Oracle query with out using self join
hi friends,
i have one table for exeample PERSTATUS
pk/fK STUDENT NUMBER SUBJECT MARKS STATUS
1 ACCOUNTS 15 RED
1 MATHS 35 YELLOW
1 SCINECE 45 GREEN
2 ACCOUNTS 55 BROWN
2 MATHS 35 YELLOW
2 SCINECE 45 GREEN
3 ACCOUNTS 15 RED
3 MATHS 35 YELLOW
3 SCINECE 45 GREEN
i want students how status is both red and yellow so i am using self join
i want students status is both red and yellow so i am using self join
SELECT PS.STUDENTNUMBER,PS.STATUS,PS.STATUS1 FROM PERSTATUS PS ,PERSTATUS PS1
WHERE PS.STUDENTNUMBER-PS1.STUDENTNUMER
PS.STATUS='RED' AND PS1.STAUTS='YELLOW'
i want students status is both RD and YELLOW AND GREEN so i am using self join( two self joinS}
SELECT PS.STUDENTNUMBER,PS.STATUS,PS.STATUS,PS2.STATUS FROM PERSTATUS PS ,PERSTATUS PS1,PERSTATUS PS2
WHERE PS.STUDENTNUMBER-PS1.STUDENTNUMER AND PS.STUDENTNUMBER-PS2.STUDENTNUMBER
PS.STATUS='RED' AND PS1.STAUTS='YELLOW' AND PS2.STAUTUS='GREEN'
if i require MORE STATUS then more self joins required, is there any alternative to achive this
and if results comes in multiple rows are accepted (since with the above query result will come in single row)
i tried to use group by (studentnumber,status) with status='red' and status='yellow'
but it is not possible could you povidet he solutionHi,
Whenever you have a problem, please post CREATE TABLE and INSERT statements for your sample data, and the exact results you want from that data. Explain how you get those results from that data.
See the forum FAQ {message:id=9360002}
Here's an example of how to post the sample data:
CREATE TABLE perstatus
( studentnumber NUMBER
, subject VARCHAR2 (10)
, marks NUMBER
, status VARCHAR2 (10)
INSERT INTO perstatus (studentnumber, subject, marks, status)
VALUES (1, 'ACCOUNTS', 15, 'RED');
INSERT INTO perstatus (studentnumber, subject , marks, status)
VALUES (1, 'MATHS', 35, 'YELLOW');
INSERT INTO perstatus (studentnumber, subject, marks, status)
VALUES (1, 'SCINECE', 45, 'GREEN');
INSERT INTO perstatus (studentnumber, subject, marks, status)
VALUES (2, 'ACCOUNTS', 55, 'BROWN');
INSERT INTO perstatus (studentnumber, subject , marks, status)
VALUES (2, 'MATHS', 35, 'YELLOW');
INSERT INTO perstatus (studentnumber, subject, marks, status)
VALUES (2, 'SCINECE', 45, 'GREEN');
INSERT INTO perstatus (studentnumber, subject, marks, status)
VALUES (3, 'ACCOUNTS', 15, 'RED');
INSERT INTO perstatus (studentnumber, subject , marks, status)
VALUES (3, 'MATHS', 35, 'YELLOW');
INSERT INTO perstatus (studentnumber, subject, marks, status)
VALUES (3, 'SCINECE', 45, 'GREEN');You were on the right track, thinking about GROUP BY. You're interested in something about the whole group of rows that has the same studentnumber. Looking at any individual row won't tell you if that row is part of the group you're interested in or not.
If you want to see information about the group as a whole, you can do the whole job with GROUP BY. In this case, studnetnumber is the only thing that an entire group has in common. If you wanted to see the studentnumbers that had both RED and YELLOW, that is:
STUDENTNUMBER
1
3here's one way you could do it:
SELECT studentnumber
FROM perstatus
WHERE status IN ('RED', 'YELLOW')
GROUP BY studentnumber
HAVING COUNT (DISTINCT status) = 2 -- That is, both RED and YELLOW
ORDER BY studentnumber
;But say you wanted to see details about individuals in the group; for example, say we want to see all the columns for students that have all 3 of RED, YELLOW and GREEN, like this:
STUDENTNUMBER SUBJECT MARKS STATUS
1 SCINECE 45 GREEN
1 ACCOUNTS 15 RED
1 MATHS 35 YELLOW
3 SCINECE 45 GREEN
3 ACCOUNTS 15 RED
3 MATHS 35 YELLOWWe used the aggregate COUNT function earlier, but aggregate functions require collapsing the results down to one row per group.
However, most of the aggregate functions, like COUNT, have analytic counterparts, that can give the same results without collapsing the result set. Here's one way to get the results above, using the analytic COUNT function:
WITH got_cnt AS
SELECT studentnumber, subject, marks, status
, COUNT ( DISTINCT CASE
WHEN status IN ('RED', 'YELLOW', 'GREEN')
THEN status
END
) OVER (PARTITION BY studentnumber) AS cnt
FROM perstatus
SELECT studentnumber, subject, marks, status
FROM got_cnt
WHERE cnt = 3
ORDER BY studentnumber
, status
; -
Hierarchical query with out using Connect by prior
Hi Guys,
I am supporting a product which is enterprise based and only allowd to write queries which are ANSII standard.
I have an requirement like If I provide the child I need to know all the parents till highest level.
My table structure is like below
Table_name : Org_unit
Columns are
Org_unit_id name desc parent_org_unit_id
I wil pass the org_unit id and want to list all the parents of the chile org_unit_id and it has to be accomplished without using connec by prior.
Please suggest me some ideas and aprroches
I am using Orcle 11g versionHi,
960593 wrote:
Hi Guys,
I am supporting a product which is enterprise based and only allowd to write queries which are ANSII standard.
I have an requirement like If I provide the child I need to know all the parents till highest level.
My table structure is like below
Table_name : Org_unit
Columns are
Org_unit_id name desc parent_org_unit_id
I wil pass the org_unit id and want to list all the parents of the chile org_unit_id and it has to be accomplished without using connec by prior.
Please suggest me some ideas and aprroches
I am using Orcle 11g version
The data model you posted (org_unit_id as primary key, parent_org_unit_id as foreign key to the same table for the parent, when there is a parent) is called the Adjacency Model because it keeps track of which nodes are adjacent (or next to) each other.
I'm familiar with 2 other ways to model hierarchies: the Nested Sets Model, and what I call the Lineage Model. I'll show how to find a given node's ancestors (in hierarchical order) in each model. Neither the Nested Sets nor the Lineage Model requires CONNECT BY or recursive WITH clauses to work.
The following table contains all the columns necessary for using each of these 3 models:
EMPNO MGR ENAME LINEAGE NS_LOW NS_HIGH
7839 KING /7839/ 1 28
7698 7839 BLAKE /7839/7698/ 2 13
7499 7698 ALLEN /7839/7698/7499/ 3 4
7900 7698 JAMES /7839/7698/7900/ 5 6
7654 7698 MARTIN /7839/7698/7654/ 7 8
7844 7698 TURNER /7839/7698/7844/ 9 10
7521 7698 WARD /7839/7698/7521/ 11 12
7782 7839 CLARK /7839/7782/ 14 17
7934 7782 MILLER /7839/7782/7934/ 15 16
7566 7839 JONES /7839/7566/ 18 27
7902 7566 FORD /7839/7566/7902/ 19 22
7369 7902 SMITH /7839/7566/7902/7369/ 20 21
7788 7566 SCOTT /7839/7566/7788/ 23 26
7876 7788 ADAMS /7839/7566/7788/7876/ 24 25
The Lineage Model keeps track of all of a given nodes ancestors, so if all you need to find are the primary keys of a given node, it's really trivial: it's all in the lineage column. If you want to find more information about those ancestors, then you can do a self-join, like this:
SELECT a.empno, a.ename, a.lineage
FROM emp a
JOIN emp d ON d.lineage LIKE '%/' || a.empno || '/%'
WHERE d.ename IN ('ADAMS')
ORDER BY d.ename
, a.lineage
Output:
EMPNO ENAME LINEAGE
7839 KING /7839/
7566 JONES /7839/7566/
7788 SCOTT /7839/7566/7788/
7876 ADAMS /7839/7566/7788/7876/
The Nested Sets model is harder to understand.
Imagine everyone in the hierarchy standing on a wide staircase, as if for a group picture; everyone on the same level standing on the same step. Everyone is holding up an umbrella that is wide enough to cover himself and all the people who are under him in the hierarchy. The people with no underlings have small umbrellas, denoted like this "<-SMITH->", and peole that manage others have bigger umbrellas, like this: <-------- JONES -------->. So the group picture might look like this:
<-------------------------------------------- KING --------------------------------------------->
<---------------------- BLAKE ---------------------> <-- CLARK --> <-------- JONES -------->
<-ALLEN-> <-JAMES-> <-MARTIN-> <-TURNER-> <-WARD-> <-MILLER-> <-- FORD--> <--SCOTT-->
<-SMITH-> <-ADAMS->
Each parent's umbrella covers all of his descendants (children, grandchildren, etc.), and nobody else.
Now draw vertical lines trom the edges of each umbrella downwards, and number those lines from left to right:
<-------------------------------------------- KING ------------------------------------------------>
| |
| <---------------------- BLAKE ---------------------> <-- CLARK -> <-------- JONES ----------> |
| | | | | | | |
| |<-ALLEN-> <-JAMES-> <-MARTIN-> <-TURNER-> <-WARD->| |<-MILLER->| |<-- FORD--> <--SCOTT---> | |
| || | | | | | | | | || || || || | | | | |
| || | | | | | | | | || || || ||<-SMITH->| |<-ADAMS-> | | |
| || | | | | | | | | || || || ||| || || | | | |
1 1 11 11 11 112 22 22 2 2 2 2
1 23 4 5 6 7 8 9 0 1 23 45 67 890 12 34 5 6 7 8
The numbers corresponding to the left arnd right edges of each umbrella are what I called ns_low and ns_high in the table. Each employyes ns_low and ns_high numbers will be inside the range of each of his ancestors ns_low and ns_high.
To find the ancestors of a given node in the nested set model you can do this:
SELECT a.empno, a.ename, a.ns_low, a.ns_high
FROM emp a
JOIN emp d ON d.ns_low BETWEEN a.ns_low
AND a.ns_high
WHERE d.ename IN ('ADAMS')
ORDER BY d.ename
, a.ns_low
Both the Lineage and Nested Sets models are good for tree structures only, whereas the Adjacency Model can handle other kinds of graphs, including graphs with loops.
Both the Lineage and Nested Sets models can be very difficult to maintain if the hierarchy is re-organized.
I'd like to repeat some of the warnings that others have made. You could write separate code for each system (Oracle, SQL Server, ...) that you want to run in, and the code for each system will be more or less different. You're looking for some code that will get the same results in all systems. That code will be more complicated that the most complicated of the single-system versions, and it will be sloweer than the slwoest of the single-system versions. You're giving up a lot of functionality, and probably also ease of maintenance, by writing code that has to work on multiple systems without changes.
Here's how I created the emp table shown above from scott.emp:
CREATE TABLE emp
AS
WITH connect_by_results AS
SELECT empno, mgr, ename
, LEVEL AS lvl
, ROWNUM AS r_num
, SYS_CONNECT_BY_PATH (empno, '/') || '/' AS lineage
FROM scott.emp
START WITH mgr IS NULL
CONNECT BY mgr = PRIOR empno
ORDER SIBLINGS BY ename
SELECT empno, mgr, ename, lineage
, (2 * r_num) - lvl AS ns_low
, (2 * r_num) + ( 2 * (
SELECT COUNT (*)
FROM connect_by_results
WHERE lineage LIKE '%/' || cbr.empno || '/%'
- (lvl + 1) AS ns_high
FROM connect_by_results cbr
This relies on the fact that the hierarchy in scott.emp has only one root (that is, a node with no parent). Computing the Nested Sets numbers is a little more complicated if you can have multiple roots. -
How to use toplink "build expression" with soundex function
We are using toplink experssion builder to build the query. can any one help me on build a query with soundex using toplink..
for example :
SELECT last_name, first_name
FROM hr.employees
WHERE SOUNDEX(last_name)
= SOUNDEX('SMYTHE');TopLink's ExpressionOperator does have an operator defined for soundex. I have an example that uses it that I customized to match you case.
I would recommend defining these queries as named queries using an after-load method:
public static void afterLoadEmployee(ClassDescriptor descriptor) {
ReadAllQuery raq = new ReadAllQuery(Employee.class);
ExpressionBuilder eb = raq.getExpressionBuilder();
Expression fnExp =
ExpressionOperator.soundex().expressionFor(eb.get("lastName"));
Expression valExp =
ExpressionOperator.soundex().expressionFor(eb.getParameter("L_NAME"));
raq.setSelectionCriteria(fnExp.equal(valExp));
raq.addArgument("L_NAME", String.class);
descriptor.getDescriptorQueryManager().addQuery("Employee.findBySoundexLastName",
raq);
}Now you can execute the query anywhere in your application using:
List<Employee> emps =
(List<Employee>)session.executeQuery("Employee.findBySoundexLastName",
Employee.class, "SMYTHE");The SQL generated is a little different due to the multiple tables used in the employee example model but here is what I got:
SELECT t0.EMP_ID, t1.EMP_ID, t0.F_NAME, t1.SALARY, t0.L_NAME, t0.GENDER, t0.VERSION, t0.ADDR_ID,
t0.MANAGER_ID, t0.END_DATE, t0.START_DATE FROM EMPLOYEE t0, SALARY t1
WHERE ((SOUNDEX(t0.L_NAME) = SOUNDEX('SMYTHE')) AND (t1.EMP_ID = t0.EMP_ID))Doug -
How to Execute sql query in PL/SQL ( a variable) with out using Cursor or REF cursor
Hi
I am building a dynamic query based on some conditions
as an example
v_query varchar2(2000);
x1 varchar2(20);
y1 varchar2(20);
z1 varchar2(20);
v_query := ' Select x,y,z into x1,y1,z1 From ... ';
Is there any way to execute the query with out using cursor or ref cursor..
Thanks
ArunBoth Tod and Eric provided valid responses given the format of the queory you supplied. Howver, if you want to use dynamic sql in either way, you need to be absolutely certain that your query will always only return a single row (e.g. SELECT COUNT(*) FROM mytable), because if it retuns more than one, your procedure will break unless you have an exception handler to handle either TOO_MANY_ROWS or OTHERS.
If you want to pull in a lot of data without walking a cursor, you should look at the BULK COLLECT options. -
Send values to IN query with parameter
Subject: send values to IN query with parameter
Hello. Hope I'll explain my problem well enough:
I have a query:
-- select id from table where id in ('100')
Now I used parameter for the IN part:
-- select id from table where id in (:param)
and I gave the parameter the value 100.
now I want to have the query with two values:
-- select id from table where id in ('100','200')
I tried to use the parameter and give him the value of: '100','200'.
It didn't worked :(
Is there a syntax to give the parameter more then one value for the IN query (with out using another table or function etc')?
Thanks in advance,Roy.This is the best solution I have for it.
variable parameter varchar2(4000);
exec :parameter := 'SYSTEM,SYS';
select username
from dba_users
where username in ( select COLUMN_VALUE from table (split_string(:parameter,',')))It uses this function
CREATE OR REPLACE
type string_table as table of varchar2(4000)
CREATE OR REPLACE
FUNCTION split_string (
string IN varchar2,
delimiter IN varchar2
) RETURN string_table IS
tab string_table;
pre integer;
post integer;
step integer;
i integer;
BEGIN
pre := 1;
step := length(delimiter);
i := 0;
tab := string_table();
loop
tab.extend;
i := i + 1;
post := instr(string,delimiter,pre);
if ( post = 0 ) then
tab(i) := substr(string,pre);
return tab;
end if;
tab(i) := substr(string,pre,post-pre);
pre := post + step;
end loop;
END;
/Bye Alessandro -
Using Toplink with Oracle Spatial (missing right parenthesis error)
Hi,
I always get the following error when I try to create spatial query with toplink.
Internal Exception: java.sql.SQLException: ORA-00907: missing right parenthesis
Any idea ? Also, there is no trace of my point in the generated sql....
Here is the generated query:
SELECT ID, [...]
FROM QUEBEC_CITY
WHERE (MDSYS.SDO_NN(GEOMETRY, JGeometry (gtype=1, dim=2, rid=8307, NULL) = 'TRUE')
ORDER BY ID ASC
Here is my code... :
double[] coord = new double[]{-71.25163d, 46.8527d};
JGeometry point = JGeometry.createPoint(coord, 2, 8307);
SpatialOperator nearestNeighbor = SpatialOperator.nearestNeighbor(session);
ReadAllQuery query = new ReadAllQuery(UrbanEdgeDescriptor.class);
ExpressionBuilder eb = query.getExpressionBuilder();
Expression geom = eb.get("geometry");
query.setSelectionCriteria(nearestNeighbor.buildExpression(geom, point));
query.addAscendingOrdering("id");
List<UrbanEdgeDescriptor> results = (List)db.getSession().executeQuery(query);
System.out.println(results!=null);The problem is the toString() on JGeometry. It does not print out a complete description the database can use inline. It produces:
JGeometry (gtype=1, dim=2, rid=8307
To get JGeometry types to work in your queries the easiest solution is to use parameter binding so the literal representation is not used.
Doug -
Help with useing toplink please..
Hello
I am writing J2EE apps that will run on a 10g app server. I thought that toplink was what I should be using to do my model layer. But there are several simple things I can't find out how to do. Things like make a LOV, how do I set a where clause and restrict what the end user is looking at?
Should I be using the ADF stuff instead? I was under the impression TopLink was the future direction at oracle so thats why I picked it. I have worked all the toplink tutorials I found. I can create mappings and all that. Setting it up isn't the problem, using it once I have it set up thats what I need to figure out. Can anyone point me in the direction of some tutorials or examples on how to use toplink? (especially in j2ee apps).
Thanks
troyTroy,
TopLink is a core piece of Oracle's enterprise Java strategy. We are dedicated to standardization of ORM persistence through EJB 3.0 and TopLink is our implementation and the basis of Sun's reference implementation. Additionally, the use of TopLink is not mutually exclusive to using ADF. Within ADF you can use a variety of persistence technologies including TopLink.
Here is a sample workshop on building applications with TopLink in ADF: http://www.oracle.com/technology/obe/obe9051jdev/ide1012/adfworkshop/buildingadfapplicationsworkshop.htm
In order to filter or restrict results coming back from the database you need to make use of queries. TopLink has 5 query options available:
1. TopLink's Expression API
2. EJB QL
3. Custom SQL
4. Stored Procedures
5. Query By Example
Quick Tour overview: http://www.oracle.com/technology/products/ias/toplink/quicktour904/que01_01.htm
You can develop your queries directly in the API of your application or you can use the mapping editors (JDeveloper or Workbench) to declaratively construct your queries. I would recommend using the mapping editors and the expression framework. This will allow the tools to assist you as your application evolves. When mappings change you will be notified if they break any of your defined queries.
In the 10.1.3 documentation you can start learning about queries at:
http://download-west.oracle.com/otn_hosted_doc/toplink/1013/DP4/_html/persun005.htm#sthref5432
Cheers,
Doug -
So, this is a very powerfull tool, but useless if you have a 3-tire application and using a persistent connection feature.
So in most cases you'll have only one Oracle user used to connect. It would be great if the flashback_transaction_query view can be extended with a CLIENT_INFO or CLIENT_IDENTIFIER fields from the session. Hope, this is not too hard to code... This information is VERY usefull in case you have invistigation of who, why and what for had changed some information.But want to check if the same concepts works incase of 'TRUNCATE' commandWhy not to check then ?
SQL> select * from t;
TID I
1 A
1 B
1 D
2 A
2 C
2 C
2 B
3 A
3 C
4 A
4 B
4 C
5 A
6 A
7 A
15 rows selected.
SQL> select DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER from dual;
GET_SYSTEM_CHANGE_NUMBER
5228349
SQL> truncate table t;
Table truncated.
SQL> select * from t as of scn 5228349;
select * from t as of scn 5228349
ERROR at line 1:
ORA-01466: unable to read data - table definition has changedMoreover, the answer is described in the documentation:
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14220/consist.htm#sthref2174
Flashback Query does not work through DDL operations that modify columns, or drop or truncate tables
Rgds. -
How to do linguistic sort query using Toplink API
Hi,
I want to write a Toplink query using linguistic sort like the following SQL,
SELECT * from emp_name
where ename LIKE 'müller%'
ORDER BY NLSSORT(ename, 'NLS_SORT=german')
I got two questions:
(1) how to implement "ORDER BY NLSSORT(name, 'NLS_SORT=german')" using Toplink API.
(2) I built linguistic index,
CREATE INDEX nls_index ON emp_name (NLSSORT(ename, 'NLS_SORT = german'));
But SQL plan shows that LIKE clause does not use index. I wonder how to enforce query with LIKE clause to use such linguistic index.
Thanks for your help in advance.
-EvanLooks like we can not do an exact word search using Java API.
-
Query with bind variable, how can use it in managed bean ?
Hi
I create query with bind variable (BindControlTextValue), this query return description of value that i set in BindControlTextValue variable, how can i use this query in managed bean? I need to set this value in String parameter in managed bean.
ThanksPut the query in a VO and execute it the usual way.
If you need to, you can write a parameterized method in VOImpl that executes the VO query with the parameter and then call that method from the UI (as a methodAction binding) either through the managed bean or via a direct button click on the page. -
Using a query with bind variable with columns defined as raw
Hi,
We are on Oracle 10.2.0.4 on Solaris 8. I have a table that has 2 columns defined as raw(18). I have a query from the front end that queries these two raw columns and it uses bind vairables. The query has a performance issue that I need to reproduce but my difficulty is that how to test the query in sqlplus using bind variables (the syntax for bind vairables fails for columns with raw datatype).
SQL> DESC TEST
Name Null? Type
ID1 RAW(18)
ID2 RAW(18)
SQL> variable b1 RAW(18);
Usage: VAR[IABLE] [ <variable> [ NUMBER | CHAR | CHAR (n [CHAR|BYTE]) |
VARCHAR2 (n [CHAR|BYTE]) | NCHAR | NCHAR (n) |
NVARCHAR2 (n) | CLOB | NCLOB | REFCURSOR |
BINARY_FLOAT | BINARY_DOUBLE ] ]
The above is the error I get - i cant declare a variable as raw.
SQL> variable b2 RAW(18);
Usage: VAR[IABLE] [ <variable> [ NUMBER | CHAR | CHAR (n [CHAR|BYTE]) |
VARCHAR2 (n [CHAR|BYTE]) | NCHAR | NCHAR (n) |
NVARCHAR2 (n) | CLOB | NCLOB | REFCURSOR |
BINARY_FLOAT | BINARY_DOUBLE ] ]
SQL> variable b3 RAW(18);
Usage: VAR[IABLE] [ <variable> [ NUMBER | CHAR | CHAR (n [CHAR|BYTE]) |
VARCHAR2 (n [CHAR|BYTE]) | NCHAR | NCHAR (n) |
NVARCHAR2 (n) | CLOB | NCLOB | REFCURSOR |
BINARY_FLOAT | BINARY_DOUBLE ] ]
--now the actual query below
SQL> SELECT * FROM TEST WHERE ID1=:B1 AND ID2 BETWEEN :B2 AND :B3;
SP2-0552: Bind variable "B3" not declared.
(this fails due to the errors earlier)Also this is a third party app schema so that we don't have the option of modifying the data type of the columns.
Thanks,
Edited by: orausern on May 10, 2011 11:30 AMTry anonymous PL/SQL block:
declare
b1 RAW(18);
b2 RAW(18);
b3 RAW(18);
begin
b1:=..;
b2:=..;
b3:=..;
SELECT col1, col2, ..
INTO ...
FROM TEST
WHERE ID1=:B1
AND ID2 BETWEEN :B2 AND :B3;
end;
/ -
Using sql query with parameter
OK, I can't find any docs on this. I can insert a parameter, but how do I insert that into the sql query?
Your first post asked how to insert a paremeter into a SQL. My example shows a value read query with a SQL function, but any SQL will work with any Query in the same pattern.
a) You call the query with session.executeQuery(query, vectorOfArguments);
b) You use #argument in the SQL string and then query.addArgument("argument");
c) You pass them in a Vector of the order in which you do the addArgument's.
- Don
Maybe you are looking for
-
IRecruitment Text Search Stopped Working
We have a number of job posting. The older posting are searchable by "Key Word" but the new ones are not. We are running the "iRecruitment Index Synchronization" every day successfully. If you search for all jobs, all jobs show. We have turned of all
-
When will Garmin Communicator Plugin 2.9.3.0 be compatible with Firefox 5 Bêta?
-
Safari/Firefox will not connect to websites. BUT Entourage works normal.
For the past 2 weeks both my iMac and MacBook Pro have experienced the same problem. Neither can connect to a website via Safari or Firefox BUT both send/receive email from Entourage. When i troubleshoot the Airport it says all is working properly. T
-
Hello all: I am attempting to create a "fast Exit" button. On Success, the button is calling an Advanced Action called QuikExit. QuiKExit is a Standard Action and is structured as Assign cpCmndExit with 1 From what little I can find, this should elic
-
I have an Iphone 5 and this morning it will not make a sound when I receive a message or call. All settings are as before and sounds are made when I check the sound settings. Any ideas on what has happened? Hardware or software issue? Any suggesti