View Variable for WHERE clause "ORA-06550, INTO clause expected"
Hi Guys,
two questions
1. can a view have variables like:
create view myview
As
myname varchar(5) = bob
select * from mytable where name = myname
2. if so, why does a simple select above cause
the error "ORA-06550, INTO clause expected" ?
Hi,
no so direct is not possible. There are workarounds, see this thread on Asktom: [url http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1448404423206]Parameterized view
Herald ten Dam
http://htendam.wordpress.com
Similar Messages
-
Variable in where clause of the logical table
Hi,
is it possible to define a variable in "where" clause of rpd's physical table (table type - select)? If yes, pls elaborate the steps including how to refresh it with every end user's request?
Thanks and Regards,
Igor
P.S.
If not, is there any workaround?Nico
thanks, but I am afraid that is not my case. I need to refresh variable value interactively with every query by a dashboard prompt. To illustrate my need just imagine a recursive SQL (defined as a view/logical table in rpd):
SELECT ....
FROM ...
WHERE ...
START WITH .... columnA=variable1
CONNECT BY PRIOR .... and columnB=varariable2;
or
SELECT c1,c2,c3,c4 from tabA where c1='A' and c2=variable1
union
SELECT c1,c2,c3,c4 from tabA where c1='A" and c2='D' and c1 NOT IN ( SELECT c1 FROM tabA where c1='A' and c2=variable1 );
So, what I want to do is to pass value(s) to my variable(s) every time when respective select (view) is executed. I see above selects are not typical ones the OBI EE is intended for but nevertheless I wonder if such kind of reports are possible to do in OBI EE.
Thanks and Regards,
Igor -
Boolean variable in where clause
Hello,
Does anyone know if it possible to include
BOOLEAN variable in where clause as following:
is_in_group BOOLEAN;
begin
is_in_group :=
portal30.wwsec_api.is_user_in_group (
p_person_id => portal30.wwctx_api.get_user_id,
p_group_id => portal30.wwsec_api.group_id('GROUPNAME')
for x in(select start_time,title
from ec_reservations
where
start_time >= '2004-JAN-01'
and rv_target_type='PU'
and is_in_group = true
Thank You,
HelenaWell, let's try it, eh?
SQL> conn scott/tiger
Connected.
SQL> CREATE OR REPLACE FUNCTION sal_test ( p_sal IN NUMBER) RETURN BOOLEAN IS
2 BEGIN
3 RETURN p_sal > 1500;
4 END;
5 /
Function created.
SQL> SELECT ename, sal
2 FROM emp
3 WHERE sal_test(sal) = TRUE;
WHERE sal_test(sal) = TRUE
ERROR at line 3:
ORA-00904: "TRUE": invalid identifier
SQL> So this is what we find. BOOLEAN is not a vlid SQL datatype, at least for Oracle. This is a source of much wailing and gnashing ot teeth. I believe there are enhancement requests for it, but no signs on the horizon.
In the example you give you need it. You would be better off doing this...
is_in_group BOOLEAN;
begin
is_in_group :=
portal30.wwsec_api.is_user_in_group (
p_person_id => portal30.wwctx_api.get_user_id,
p_group_id => portal30.wwsec_api.group_id('GROUPNAME')
IF is_in_group = true THEN
FOR x IN (select start_time,title
from ec_reservations
where start_time >= '2004-JAN-01'
and rv_target_type='PU' )
...Otherwise you have to recast your function so it returns VARCHAR2 with values of 'TRUE' and 'FALSE' (or NUMBER returning 0 and 1, whatever).
Cheers, APC -
How To change the ADF View Object query where-clause at RunTime?
I am trying to create a simple display page which will display user data (username, assoc_dist_id, assoc_agent_id, status , etc). The User data is stored in a database table and i am using an ADF Read Only table based on the View Object to display the data on the JSF page.
However, i want to display only the users that a particular person accessing the page has the AUTH LEVEL to see. e.g. If the person accessing the page is an 'ApplicationAdministrator' then the page should display all users in the table, If its a 'DistributorAdministrator' then the page should display only users associated with that Distributor (i.e. assoc_dist_id = :p_Dist_id ) and If its an 'AgentAdministrator' , then the page should display only users associated with that Agent ( i.e. assoc_agent_id = :p_Agent_id).
Currently my af:table component displays all the users in the table because the query for the view object is (select * from users) . However, i want to use the same viewobject and just set the where-clause at runtime with the appropriate parameter to restrict the dataset returned.
Do anyone knows how to accomplish this ?David,
See the custom method initializeDynamicVariableDefaults() in the SRViewObjectImpl.java class in the FrameworkExtentions project in the SRDemoSampleADFBC sample application. You can find out how to install the demo if you haven't already from the ADF Learning Center at:
http://www.oracle.com/technology/products/adf/learnadf.html
This class is a framework extension class for view objects that adds a neat, generic feature to be able to dynamic default the value of named bind variables. You can read more about what framework extension classes are and how to use them in Chapter 25, "Advanced Business Components Techniques" of the ADF Developer's Guide for Forms/4GL Developers, also available at the learning center above.
It is an example of generic framework functionality that "kicks in" based on the presence of custom metadata properties on a named bind variable. See section 25.3.3 "Implementing Generic Functionality Driven by Custom Properties" in the dev guide for more details. Using this sample code, if you add a bind variable to a view object, and define a custom metadata property named "DynamicDefaultValue" on that bind variable, and set this custom metadata property to the value "CurrentUser", then that bind variable will have its value dynamically defaulted to the name of the authenticated user logged in. If instead you set this custom property to the value "UserRole", then the bind variable will be set to the comma-separated string containing the list of roles that the authenticated user is part of.
Once you've created a framework extension class for view objects like this, you can have the view objects you create inherit this generic functionality.See section 25.1.4 "How to Base an ADF Component on a Framework Extension Class" in the dev guide for more info on this.
By adapting a technique like this (or some idea similar that better suits your needs) you can have your view object query contain bind variables whose values automatically take on the defaults based on something in the user-session environment. -
ADF BC View Objects: Disappearing where clauses
Playing around with the 11g Technical Preview I find out that sometimes the where clauses - added to View Objects by means of the new "Join Type" field in the VO-editor UI - disappear.
I'm not able to reproduce exactly and "on demand", but it seems to happen when the sources of more than one View Object are open simultaneously and/or the XML definition of a View Object is edited directly on the Source-tab.Today I succeeded in reproducing:
Two tables:
TAB_MASTER:
ID NUMBER NOT NULL
DESCRIPTION VARCHAR2 NOT NULL
TAB_DETAIL:
ID NUMBER NOT NULL
MASTER_ID NUMBER NOT NULL
DESCRIPTION VARCHAR2 NOT NULL
TAB_DETAIL.MASTER_ID is a foreign key referencing TAB_MASTER.ID.
Steps to reproduce:
1. Generate default ADF BC objects from database tables.
2. Open definition of TAB_DETAIL View Object.
3. Go to the Entity Objects tab
4. Add TAB_MASTER Entity Object to the Selected Entities Objects. Association and Join Type are filled in automatically.
5. Go to the Query tab and go to SQL tab in de Property Inspector. Where clause is filled.
6. Go to the Attributes tab and click Add from Entity...
7. Add TAB_MASTER.DESCRIPTION attribute.
8. Again, go to the Query tab and go to SQL tab in de Property Inspector. Where clause is still filled.
9. Go to the Attributes tab and select MASTER_ID attribute.
10. Click icon to add List Of Values
11. In List Of Values dialog add View Object TAB_MASTER and add the correct pairs of List Return Values for the ID and (MASTER) DESCRIPTION attributes.
12. After completing the List Of Values dialog go to the Query tab -> SQL tab again. The where clause added to join the Entity Objects (see step 5.) is cleared, resulting in a wrong SQL statement for the View Object. -
How can we use form variable in where clause while personalization
Dear,
I have a requirment for using select in personalization, actully we have created temporary table, now we want to get data from select satatement on event"when-new-record-instance' trigger, now in action tab i have selected action which is property and message, in message column showing value "${item.q_res.transaction_id.value}" it shows on validate button but when this form variable use in action type(property) which is consist on select statement "=SELECT to_char(QTY) FROM TEST_TABLE where transaction_id = ${item.q_res.transaction_id.value}" system didn't get value pressing validate button although there is a single record in customize table while without where cluase was getting data perfectly.
please advice.>
I am looking for to decode the actual db value something in different for my report.
like if A then Accepted
elseif R then Rejected
elseif D then Denied
these conditions I have to check in where clause.
>
what are you trying to do?
may be you are looking for
select * from tab1,tab2
where a.tab1 = b.tab2
and
(decode(:code, 'A','Accepted') = <table_column>
or
decode(:code, 'R','Rejected') = <table_column>
or
decode(:code, 'D','Denied') = <table_column>
) -
hello,
we want to build an dynamic sql IR. so when a user logs into our application we have an page process that fills an application item :F_ITEM_WHERE with part of the where clause from an IR. On the page with the IR we have as region source something similiar to:
SELECT test_api_per_cus.get_per_name(id_per_cus) as Customer,
test_api_per_cus.get_per_cus_nr(id_per_cus) as "Cus.-Nr",
vtr_nr AS "VS-Nr."
id_vtr,
id_per_cus
FROM test_vtr
WHERE test_vtr.id_grp = :F_ID_GRP
AND test_vtr.id_per_cus IN
*(SELECT id_per_cus*
FROM viva_per_cus
WHERE LEVEL BETWEEN test_api_per_emo_r_tree.get_per_emp_r_tree_from(:F_ID_PER_EMP,
*:F_ID_GRP) AND*
test_api_per_emp_r_tree.get_per_mit_r_tree_to(:F_ID_PER_EMP,
*:F_ID_GRP)*
START WITH per_cus_nr =
test_api_per_emp_r_tree.get_per_emp_r_tree_tree(:F_ID_PER_EMP,
*:F_ID_GRP)*
CONNECT BY PRIOR per_cus_nr = per_cus_number
AND PRIOR id_grp = :F_ID_GRP)
AND EXISTS
so we want outsourcing the marked part of the where clause into :F_ITEM_WHERE. The result is as following:
SELECT test_api_per_cus.get_per_name(id_per_cus) as Customer,
test_api_per_cus.get_per_cus_nr(id_per_cus) as "Cus.-Nr",
vtr_nr AS "VS-Nr."
id_vtr,
id_per_cus
FROM test_vtr
WHERE test_vtr.id_grp = :F_ID_GRP
AND test_vtr.id_per_cus IN *|| :F_ITEM_WHERE ||*
AND EXISTS
Here says Apex that the Query cannot be parsed...if we fill the item plus 'AND test_vtr.id_per_cus IN' so our statement looks like this:
SELECT test_api_per_cus.get_per_name(id_per_cus) as Customer,
test_api_per_cus.get_per_cus_nr(id_per_cus) as "Cus.-Nr",
vtr_nr AS "VS-Nr."
id_vtr,
id_per_cus
FROM test_vtr
WHERE test_vtr.id_grp = :F_ID_GRP
*:F_ITEM_WHERE*
AND EXISTS
the query can parse but after that running apex says: bind :F_ITEM_WHERE not possible
Anyone got an solution for this? I think it´s only a syntax thing or something...
Thanks Daniel
Edited by: user12086353 on 14.09.2010 06:01When posting code on the forum, put {noformat}{noformat} (with the curly brackets and the word code in lowercase) above and below your code like this...
{noformat}{noformat}
SELECT *
FROM emp
{noformat}{noformat}
It will then appear like this, preserving formatting...SELECT *
FROM emp
Please post your code, properly formatted of +exactly+ what you have put in the region source. I'm not convinced that you need dynamic SQL at all.
Cheers
Ben -
How to validate a user input for where clause?
I have a situation to validate a where clause which is input by the user.
Because the query will be run against huge tables and we need to notify the user if they input the clause is not valid.
I use the below query to try:
Select 'A' from blablabla where user_input_where_clause and 1=0;
however, it can not capture the error when the user input:
'name=123' while the right condition should be name='123'.
Can you pls advise ?In this particular case, Oracle will not even try to run the SQL statement because of the syntax error. IF the WHERE condition supplied does not make sense, Oracle will not execute the statement, so it does not matter if the query accesses huge tables.
SQL> Select 'A' from blablabla where 'name=123' and 1=0 ;
Select 'A' from blablabla where 'name=123' and 1=0
ERROR at line 1:
ORA-00920: invalid relational operator
SQL>IF you have a restriction as to what type/value can user specify for the where condition (asuming it would make sense to SQL engine), you would have to do it before submitting to the database.
Note, however, that user could specify any condition they like, having potentially damaging effects. -
How to change access path for 'where' clause by using HINTS?
I searched a loooot of posts and haven't found a solution for my case. I don't even know whether it is possible or not. Is it possible to change the sequence of Oracle "Predicate Information"?
Here is my SQL and Oracle's execution plan.
SELECT Max(logId) AS logId FROM online_users_t
WHERE online_users_date >= to_date('2011-09-19 10:00:00') - 3.2 AND online_users_date <= to_date('2011-09-19 10:00:00') AND online_users_result in (1, -1)
GROUP BY online_users_user
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 24800 | 629K| 1336 (1)| 00:00:17 |
| 1 | HASH GROUP BY | | 24800 | 629K| 1336 (1)| 00:00:17 |
|* 2 | TABLE ACCESS BY INDEX ROWID| ONLINE_USERS_T | 38833 | 985K| 1334 (1)| 00:00:17 |
|* 3 | INDEX RANGE SCAN | ONLINE_USERS_T_IDX | 116K| | 313 (1)| 00:00:04 |
Predicate Information (identified by operation id):
2 - filter("ONLINE_USERS_RESULT"=(-1) OR "ONLINE_USERS_RESULT"=1)
3 - access("ONLINE_USERS_DATE">=TO_DATE(' 2011-09-16 05:12:00', 'syyyy-mm-dd
hh24:mi:ss') AND "ONLINE_USERS_DATE"<=TO_DATE(' 2011-09-19 10:00:00', 'syyyy-mm-dd
hh24:mi:ss'))I have 2 conditions in my 'where' clause, one is date range and the other is 'online_users_result in (1, -1)'. It seems that Oracle filter the table by using 'online_users_result in (1, -1)' first, then access it through date range.
What I want to do is firstly filtering the table by using date range followed by other things. How can I do it?
Any clue or help would be highly appreciated.
Thanks in advance.It seems that Oracle filter the table by using 'online_users_result in (1, -1)' first, then access it through date range. No it's not.
What I want to do is firstly filtering the table by using date range followed by other things. How can I do it?That's precisely what it's doing now.
It is using the T_IDX index to quickly find all rows that satisfy the range predicate on the date column.
And then filter those rows to only retrieve the ones that satisfy the other predicate (... in (1,-1)). -
Urgent Help - Getting Org_id for where clause
HI All,
I am trying to customise "Out of office rule" - Delegate LOV sql, it works fine from responsibility e.g. iProcurment etc. but not from HomePage worklist. The problem is getting the Org_id of the user logged-in I have tried following different methods:
From VO:
(1) FND_GLOBAL.ORG_ID
(2) fnd_profile.value('ORG_ID')
From CO: by setting the where clause
(1) oadbtransaction.getOrgId()
(2) oapagecontext.getOrgId()
But every time same problem some how it's not working from Application HomePage but it will work fine if user will click on any responsibility and then come back to homepage.
Please help it's an urgent issue.
Thanks!Anoop,
That what are the options to get the Org id on the home page for the user logged-in as user can set "Out of Office Rules" with out clicking on any responsibility ...directly from the home page.
Thanks -
Please help. Thank you for your time and expertise.
Prerequisites: sql query needs to be a view. Real view is more than recursion. It computes location path, is used in JOINs and returns this path.
Problem: no matter what I tried, sql server does not produce 'index seek' when using variable but does with literal.
See full reproduction code below.
I expect that query SELECT lcCode FROM dbo.vwLocationCodes l WHERE l.lcID = @lcID will seek UNIQUE index but it does not.
I tried these:
1. Changing UX and/or PK to be CLUSTERED.
2. query OPTION(RECOMPILE)
3. FORCESEEK on view
4. SQL Server 2012/2014
5. Wrap it into function and CROSS APPLY. On large outer number of rows this just dies, no solution
but to no avail. This smells like a bug in SQL Server. I am seeking your confirmation.
I am thinking it is a bug as variable value is high-cardinality, 1, and query is against unique key. This must produce single seek, depending if clustered or nonclustred index is unique
Thanks
Vladimir
use tempdb
BEGIN TRAN
-- setup definition
CREATE TABLE dbo.LocationHierarchy(
lcID int NOT NULL ,
lcHID hierarchyid NOT NULL,
lcCode nvarchar(25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
lcHIDParent AS lcHID.GetAncestor(1) PERSISTED,
CONSTRAINT PK_LocationHierarchy_lcID PRIMARY KEY NONCLUSTERED (lcID ASC),
CONSTRAINT UX_LocationHierarchy_pltID_lcHID UNIQUE CLUSTERED (lcHID ASC)
-- add some data
INSERT INTO dbo.LocationHierarchy
VALUES
(1, '/', 'A')
,(2, '/1/', 'B')
,(3, '/1/1/', 'C')
,(4, '/1/1/1/', 'D')
--DROP VIEW dbo.vwLocationCodes
GO
CREATE VIEW dbo.vwLocationCodes
AS
WITH ru AS
SELECT
lh.lcID
,lh.lcCode
,lh.lcHID
,CAST('/' + lh.lcCode + '/' as varchar(8000)) as LocationPath
-- to support recursion
,lh.lcHIDParent
FROM dbo.LocationHierarchy lh
UNION ALL
SELECT
ru.lcID
,ru.lcCode
,ru.lcHID
,CAST('/' + lh.lcCode + ru.LocationPath as varchar(8000)) as LocationPath
,lh.lcHIDParent
FROM dbo.LocationHierarchy lh
JOIN ru ON ru.lcHIDParent = lh.lcHID
SELECT
lh.lcID
,lh.lcCode
,lh.LocationPath
,lh.lcHID
FROM ru lh
WHERE lh.lcHIDParent IS NULL
GO
-- get data via view
SELECT
CONCAT(SPACE(l.lcHID.GetLevel() * 4), lcCode) as LocationIndented
FROM dbo.vwLocationCodes l
ORDER BY lcHID
GO
SET SHOWPLAN_XML ON
GO
DECLARE @lcID int = 2
-- I believe this produces bad plan and is defect in SQL Server optimizer.
-- variable value cardinality is 1 and SQL Server should know that. Optiomal plan is to do index seek with key lookup.
-- This does not happen.
SELECT lcCode FROM dbo.vwLocationCodes l WHERE l.lcID = @lcID -- bad plan
-- this is a plan I expect.
SELECT lcCode FROM dbo.vwLocationCodes l WHERE l.lcID = 2 -- good plan
-- I reviewed these but I need a view here, can't be SP
-- http://sqlblogcasts.com/blogs/tonyrogerson/archive/2008/05/17/non-recursive-common-table-expressions-performance-sucks-1-cte-self-join-cte-sub-query-inline-expansion.aspx
-- http://social.msdn.microsoft.com/Forums/sqlserver/en-US/22d2d580-0ff8-4a9b-b0d0-e6a8345062df/issue-with-select-using-a-recursive-cte-and-parameterizing-the-query?forum=transactsql
GO
SET SHOWPLAN_XML OFF
GO
ROLLBACK
Vladimir MoldovanenkoHere is more... note that I am creating table Items and these can be in Locations.
I am trying LEFT JOIN and OUTER APLLY to 'bend' query into NESTED LOOP and SEEK. There has to be nested loop, 2 rows against 4. But SQL Server fails to generate optimal plan with SEEK. Even RECOMPILE does not help
use tempdb
BEGIN TRAN
-- setup definition
CREATE TABLE dbo.LocationHierarchy(
lcID int NOT NULL ,
lcHID hierarchyid NOT NULL,
lcCode nvarchar(25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
lcHIDParent AS lcHID.GetAncestor(1) PERSISTED,
CONSTRAINT PK_LocationHierarchy_lcID PRIMARY KEY NONCLUSTERED (lcID ASC),
CONSTRAINT UX_LocationHierarchy_pltID_lcHID UNIQUE CLUSTERED (lcHID ASC)
-- add some data
INSERT INTO dbo.LocationHierarchy
VALUES
(1, '/', 'A')
,(2, '/1/', 'B')
,(3, '/1/1/', 'C')
,(4, '/1/1/1/', 'D')
--DROP VIEW dbo.vwLocationCodes
GO
--DECLARE @Count int = 10;
--WITH L0 AS (SELECT N FROM (VALUES(1),(1),(1),(1),(1),(1),(1),(1),(1),(1)) N (N))-- 10 rows
--,L1 AS (SELECT n1.N FROM L0 n1 CROSS JOIN L0 n2) -- 100 rows
--,L2 AS (SELECT n1.N FROM L1 n1 CROSS JOIN L1 n2) -- 10,000 rows
--,L3 AS (SELECT n1.N FROM L2 n1 CROSS JOIN L2 n2) -- 100,000,000 rows
--,x AS
-- SELECT TOP (ISNULL(@Count, 0))
-- ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) as Number
-- FROM L3 n1
--SELECT Number as itmID, NTILE(4)OVER(ORDER BY Number) as lcID
--INTO dbo.Items
--FROM x
----ORDER BY n1.N
--ALTER TABLE dbo.Items ALTER COLUMN itmID INT NOT NULL
--ALTER TABLE dbo.Items ADD CONSTRAINT PK PRIMARY KEY CLUSTERED (itmID)
CREATE TABLE dbo.Items (itmID int NOT NULL PRIMARY KEY, lcID int NOT NULL)
INSERT INTO dbo.items
VALUES(1, 1)
,(2, 3)
GO
CREATE VIEW dbo.vwLocationCodes
AS
WITH ru AS
SELECT
lh.lcID
,lh.lcCode
,lh.lcHID
,CAST('/' + lh.lcCode + '/' as varchar(8000)) as LocationPath
-- to support recursion
,lh.lcHIDParent
FROM dbo.LocationHierarchy lh
UNION ALL
SELECT
ru.lcID
,ru.lcCode
,ru.lcHID
,CAST('/' + lh.lcCode + ru.LocationPath as varchar(8000)) as LocationPath
,lh.lcHIDParent
FROM dbo.LocationHierarchy lh
JOIN ru ON ru.lcHIDParent = lh.lcHID
SELECT
lh.lcID
,lh.lcCode
,lh.LocationPath
,lh.lcHID
FROM ru lh
WHERE lh.lcHIDParent IS NULL
GO
-- get data via view
SELECT
CONCAT(SPACE(l.lcHID.GetLevel() * 4), lcCode) as LocationIndented
FROM dbo.vwLocationCodes l
ORDER BY lcHID
GO
--SET SHOWPLAN_XML ON
GO
DECLARE @lcID int = 2
-- I believe this produces bad plan and is defect in SQL Server optimizer.
-- variable value cardinality is 1 and SQL Server should know that. Optiomal plan is to do index seek with key lookup.
-- This does not happen.
SELECT lcCode FROM dbo.vwLocationCodes l WHERE l.lcID = @lcID-- OPTION(RECOMPILE) -- bad plan
-- this is a plan I expect.
SELECT lcCode FROM dbo.vwLocationCodes l WHERE l.lcID = 2 -- good plan
SELECT *
FROM dbo.Items itm
LEFT JOIN dbo.vwLocationCodes l ON l.lcID = itm.lcID
OPTION(RECOMPILE)
SELECT *
FROM dbo.Items itm
OUTER APPLY
SELECT *
FROM dbo.vwLocationCodes l
WHERE l.lcID = itm.lcID
) l
-- I reviewed these but I need a view here, can't be SP
-- http://sqlblogcasts.com/blogs/tonyrogerson/archive/2008/05/17/non-recursive-common-table-expressions-performance-sucks-1-cte-self-join-cte-sub-query-inline-expansion.aspx
-- http://social.msdn.microsoft.com/Forums/sqlserver/en-US/22d2d580-0ff8-4a9b-b0d0-e6a8345062df/issue-with-select-using-a-recursive-cte-and-parameterizing-the-query?forum=transactsql
GO
--SET SHOWPLAN_XML OFF
GO
ROLLBACK
Vladimir Moldovanenko -
How to select value from database view with * in wher clause
Hi ,
I ahve a database view with some fields.
Now my requirement is to serach a single row on the basis of process type.
Process type can have values like ZBA,ZBC,ZBD,ZBE or similarly anything starting with ZB.
Now i know that starting two letters will be ZB , but dont knwo the last letter.
So how should i use select query for the same?
Should i use like operator for the same?
regards
PGhi,
u can use character '%'.sample code like this
SELECT reltype
instid_a
catid_a
instid_b
FROM /dbm/ord_docflow
INTO TABLE it_link
FOR ALL ENTRIES IN it_pnwtyh
WHERE instid_a = it_pnwtyh-instid_a AND
instid_b LIKE 'QMSM%' AND
typeid_a = 'BUS2400' AND
typeid_b = 'BUS2400' AND
catid_a = 'BO' AND
catid_b = 'BO' AND
reltype = 'VONA'.
this is similar to using* while we fetch values from table.in the above code only i no QMSM rest values not sure,so used QMSM% -
SELECT LIST throws error for WHERE CLAUSE
Hi All
I am struck with, what looking like a trivial error, but I don't know how to settle it down. I am new to Apex (3.1). I am experimenting with. I have Oracle 10g running on Windows.
I have a dropdown item in one of my pages (SELECT list). I am trying to display few items there dynamically (depends on the user who logged in). I set it as SELECT LIST and entered the following query in "List of Values".
select enrolled_course display_value, course_id return_value
from COMP_LIST
where stu_id = :APP_USER
order by 1I got the following error.
1 error has occurred
LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query.Then, I tried the step by step instruction from "Oracle® Application Express - Advanced Tutorials -Release 3.1.2 -E10497-02". Using creating list of values creation as seperately. That too, I got the same error.
I am doing it wrong I suppose. Please correct me. Thanks in advance
With Regards
Guru
Edited by: guru paran on Oct 16, 2008 5:12 PMThanks Andy
When I hardcoded, it worked.
select enrolled_course display_value, course_id return_value
from COMP_LIST
--where-- --emp_id-- = --100--
where stu_id = 100
order by 1
{code}
:APP_USER is not working then, Now, I should be using v('APP_USER')? When I tried v('APP_USER'), I got the same error back! The COMP_LIST is a view. Is there some problem with the view then?
But again, I am able to select from it without WHERE (now with hardcoded value also)....
Edited by: guru paran on Oct 16, 2008 6:26 PM
Added [code] tags
Edited by: guru paran on Oct 16, 2008 6:42 PM
It is STU_ID and not EMP_ID
Edited by: guru paran on Oct 16, 2008 6:43 PM -
PHP create array/variable for two dropdowns and insert into one column
Hello,
I have been trying for days to get this to work. Any help would be very appreciated.
The dropdown code:
<?php //Dropdowns for hours and minutes
$hour = array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
$min = array (.00, .25, .50 ,.75);
echo '<span class="red">Hours :</span><select name="hour">';
foreach ($hour as $value1) {
echo "<option value=\"$value1\">$value1</option>\n";
echo '</select>';
echo '<span class="red">Quarter Hours :</span><select name="min"';
foreach ($min as $value2) {
echo "<option value=\"$value2\">$value2</option>\n";
echo '</select>';
//Dropdowns for hours and minutes
//Create variable to send to the time field using a hidden field
function input_time($value1, $value2) {
$time = count($value1 + $value2);
return $input_time;
?>
<input name="time" type="hidden" value="<?php echo "$input_time";?>" />
The Schema:
CREATE TABLE `ND_time_sheet` (
`time_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`day` varchar(10) NOT NULL DEFAULT '',
`date` varchar(8) NOT NULL DEFAULT '',
`project_id` varchar(8) DEFAULT NULL,
`non_bill` tinytext,
`staff_id` varchar(5) NOT NULL DEFAULT '',
`time` decimal(3,2) unsigned zerofill DEFAULT NULL,
`type` varchar(30) NOT NULL DEFAULT '',
PRIMARY KEY (`time_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
Thanks!9677670421 wrote:
hi... i am trying to do the same but i am having the 2D array of data when first time if i clicked in table it should show the the first row values and if i again clicked same value should show in the second row and so on... but insted in my code if clicked (using insert into array ) at a time it is showing two rows of the data pl help me ..........
This seems to be a different problem, so you should have started a new thread instead.
Can you show us your code, tell us what you are clicking, tell us what you get and what you expect to get instead. Thanks.
LabVIEW Champion . Do more with less code and in less time . -
Hi,
I have a selet statement where i need to write below logic .
SELECT bldat xblnr kunnr rstgr xref1 xref2
bukrs belnr blart wrbtr waers shkzg
buzei zfbdt dmbe2 sgtxt augbl augdt
zbd1t zbd2t
FROM bsid
INTO CORRESPONDING FIELDS OF TABLE int_output
WHERE bldat IN so_bldat AND
shkzg IN so_shkzg AND
wrbtr IN so_wrbtr.
Range needs to be entered where from value (for wrbtr field) is -ve negative and to value is +ve positive e.g., -1000 to +200 -:in this case go to BSID with value from 0 to 1000 with debit/credit indicator H and again 0 to 200 with debit/credit indicator S..
can somebody tell me how to set range for the above requirement.
Really need help.
Edited by: Thomas Zloch on May 25, 2011 3:27 PMchange:
AND
shkzg IN so_shkzg AND
wrbtr IN so_wrbtr.
to
and ( (SHKZG eq 'H' and wrbtr le 1000 ) or
(SHKZG eq 'S' and wrbtr le 200 ) ). ??
Maybe you are looking for
-
Need to find the status of the tranaction pc00_m40_calc
gurus , yesterday i began the payroll processing thro transaction pc00_m40_calc . usually it will take around 8 hours to complete . yesterday i started it by evening 6 pm and left for the day today morn when i returned , my pc was shut down . I a
-
Dynamic Update of Combo Boxes with Struts
I need to update one dropdown box based off of the selection of the other. When I select an option I am using an onchange="reload()" to reload the page. The problem with this is as far as I can tell is only refreshing the html in the browser and not
-
Urgent Airport Update Needed!
*Dear Apple;* I manage a coffee shop, probably the ONLY internet cafe in the city equipped with only Mac stations. Well, in effort to go "Mac only", I got your little Airport toy and sure, it's got some fun features, but it's missing basic features
-
Displaying 2 parameters with descriptions in same line of Selection-Screen
Hi All, I want to know how can we display 2 parameters with descriptions in same line of Selection-Screen. Means in selection screen first we will give comment as <b>Material no</b> then <b>parameter box as MARA-MATNR</b>, In the same line descriptio
-
Question about security issues regarding 'cp' and 'mv'
Ok, I wondered about how 'cp' and 'mv' are really working. I have some guesses but I need these things to be confirmed. Here is what I have: A partition with a unix file system, say ext2 or 3 (does this make a difference here?) containing *very* sens