Slection condition with Like
Hi Gurus,
I try to extrat from the table CSKS the cost element (KSTAR) only those starting by 8. I have written this code but I always receive a sy-subrc = 0.
PARAMETERS srch_str TYPE cska-kstar.
TYPES: BEGIN OF ty_cska,
kstar TYPE cska-kstar,
END OF ty_cska.
data:
i_cska TYPE STANDARD TABLE OF ty_cska.
CONCATENATE '8' '%' INTO srch_str.
select kstar from cska
into table i_cska
where kstar like srch_str.
Anybode has an idea?
Thanx in advance for your help.
Regards,
Mohamed.
Hello
Try direct condition:
select kstar from cska
into table i_cska
where kstar like '008%'.
Similar Messages
-
CASE Statement in Where Condition with Multi Valued parameter in SSRS
Hi All,
I am little confused while using CASE statement in Where condition in SSRS. Below is my scenario:
SELECT
Logic here
WHERE
Date IN (@Date)AND
(CASE
WHEN NAME LIKE 'ABC%' THEN 'GROUP1'
WHEN ID IN ('123456', '823423','74233784') THEN 'GROUP2'
WHEN ABC_ID IS NULL THEN 'GROUP3'
ELSE 'GROUP4'
END ) IN (@GROUP)
So above query uses WHERE condition with CASE statement from @GROUP parameter. I want to pass this parameter as multi- valued parameter and hence I have used CASE statement IN (@GROUP).
For @Date one dataset will pass the available and default values and
for @GROUP parameters, another dataset will pass the available and default values.
But this is not working as expected. Please suggest me where I am making mistake in the query.
Maruthu | http://sharepoint-works.blogspot.comHi Maruthu,
According to your description, I create a sample report in my local environment. It works as I expected. In your scenario, if the selected values from the Date parameter contains some of the Date field values, the selected values from the GROUP parameter
contains some of GROUPS (‘GROUP1’,’GROUP2’,’GROUP3’,’GROUP4’) and the corresponding when statement is executed , then the dataset returns the corresponding values.
In order to trouble shoot this issue, could you tell us what results are you get and what’s your desired results? If possible, you can post the sample data with sample dataset, then we can make further analysis and help you out.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Set_block_property with Like and Between and function
Hellow All
I need to find out record where Column Name between
:Text_item1 and :Text_item2 with Default_where
For example Manu guide me to find out record with
SET_BLOCK_PROPERTY('Block53', DEFAULT_WHERE, 'name like ''' || :block70.text || '%''');
go_block('block53');
EXECUTE_QUERY;
Now i need
To find our Record where name between :block70.Text1 and :Block70.text2 with Like Function
For example
I have one Column :NAME
I want to find out record in name Column with Default Where option where name between Text1 and Text2
I Hope you guys understand my requirement
Regards
Shahzaib ismailHai,
Try
SET_BLOCK_PROPERTY('BLOCK53', DEFAULT_WHERE, 'NAME BETWEEN ''' || :BLOCK70.TEXT1 || ''' AND ''' || :BLOCK70.TEXT2 || '''');
GO_BLOCK('BLOCK53');
EXECUTE_QUERY;and when you are using BETWEEN for character fields, then LIKE will be there.
Example, your NAME field have,
1) Abcde
2) Asdf
3) Awer
And if your condition is NAME BETWEEN 'A' AND 'Z' then you will get all daya.
And if your condition is NAME BETWEEN 'Ad' AND 'Z' then you will get 2 and 3. like that.
Regards,
Manu.
If this answer is helpful or correct, please mark it. Thanks. -
Issue While executing the Query for Pagination using ROWNUM with like
Issue While executing the Query for Pagination using ROWNUM with like.
Database is Oracle11G.
Oracle Database Table contains 8-9 lakh records
1) SQL equal (=)
SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
WHERE A.REFERENCE = 'KMF22600920'
Execution Time:- 0.00869245 seconds
Returns 2 resultsets
2) SQL like (one %)
SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
WHERE A.REFERENCE = 'KMF22600920%'
Execution Time:- 0.01094301 seconds
Returns 2 resultsets
3) SQL like (two%)
SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
WHERE A.REFERENCE like '%KMF22600920%'
Execution Time:- 6.43989658 seconds
Returns 2 resultsets
In Pagination, we are using Modified version of SQL Query 3) with ROWNUM as mentioned below :-
4) SELECT * FROM (
SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
WHERE REFERENCE like '%KMF22600920%' AND ROWNUM <= 20 ) WHERE RNUM > 0
Execution Time:- Infinite
ResultSets:- No as execution time is infinite
a) Instead of like if we use = in the above query it is returning the 2 resultsets (execution time 0.02699282 seconds)
b) Instead of two % in the above query, if use one example REFERENCE like 'KMF22600920%' it is returning the 2 resultsets (execution time 0.03313019 seconds)
Issue:- When using two % in like in the above query i.e. REFERENCE like '%KMF22600920%' AND ROWNUM <= 20 ) , it is going to infinite.
Could you please let us know what is the issue with two % used in like and rownum
5) Modified version of Option1 query (move out the RNUM condition AND RNUM <= 20)
SELECT * FROM (
SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
WHERE REFERENCE like '%KMF22600920%' ) WHERE RNUM > 0 AND RNUM <= 20
Execution Time:- 7.41368914 seconds
Returns 2 resultsets
Is the above query is best optimized query which should be used for the Pagination or still can improve on this ?This would be easier to diagnose if there was an explain plan posted for the 'good' and 'bad' queries. Generally speaking using '%' on both sides precludes the use of any indexes.
-
Using where condition with dynamic internal table
Hi Friends.
How to use where condition with dynamic internal table ?
Regards,
Amit RautHai Amit
REPORT ZDYNAMIC_SELECT .
TABLES: VBAK.
DATA: CONDITION TYPE STRING.
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
END OF ITAB.
SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.
CONCATENATE 'VBELN' 'IN' 'S_VBELN.'
INTO CONDITION SEPARATED BY SPACE.
SELECT VBELN POSNR FROM VBAP INTO TABLE ITAB
WHERE (CONDITION).
LOOP AT ITAB.
WRITE 'hello'.
ENDLOOP.
Thanks & Regards
Sreenivasulu P -
A trouble with "LIKE" in a select statement
Hi!
I'm having trouble with "LIKE" in a select statement...
With Access I can make the following and everything works well:
SELECT name, birthday
FROM client
WHERE birthday LIKE '*/02/*';
but if try to do it in my application (it uses Access), it doesn't work - I just can't understand that!!!
In my application the "month" is always the currently month taken from the "System". Look what I'm doing...
String query1 = "SELECT name, birthday " +
"FROM client " +
"WHERE birthday " +
"LIKE '*/" +
pMonth +
"/*' " +
"ORDER BY birthday ASC ";
ResultSet rs = statement1.executeQuery(consulta1);
boolean moreRecords = rs.next();
The variable "moreRecords" is always "false", the query returns nothing although the table "client" has records that attend the query.
Please, anyone can help me?! It's a little bit urgent.
Thanks,
Katia.Hi Katia,
I'll bet the problem lies with the characters you're using to escape the LIKE clause. You're using the ones that Access likes to see, but that's not necessarily what's built into the JDBC-ODBC driver class.
You can find out what the correct escape wildcard characters are from the java.sql.DatabaseMetaData.getSearchStringEscape() method. It'll tell you what to use in the LIKE clause.
I'm not 100% sure about your code. It doesn't use query1 anywhere. I'd do this:
String query = "SELECT name, birthday FROM client WHERE birthday LIKE ? ORDER BY birthday ASC";
PreparedStatement statement = connection.createStatement(query);
String escape = connection.getMetaData().getSearchStringEscape();
String test = escape + '/' + pMonth + '/' + escape;
statement.setString(1, test);
ResultSet rs = statement.executeQuery();
while (rs.hasNext())
// load your data into a data structure to pass back.
rs.close();
statement.close();Let me know if that works. - MOD -
Hi All
I have one sharepoint list with huge data i.e with 20columns and more than 200 records with the fields .
Suppose lets consider there are A,B,C,D,E,F,G,H columns.
Now i want to create one form with the fields A,C,E.
When the user enter the existing data of list for columns A,C..based on C value the E column value should change and update that particular item in the list.
Please guide me without visual web part can we acheive this by Sharepoint designer 2013 or what would be the preferable solution.
Please help me on this as it is very urgent from me..
Thanks in Advance
Sowjanya GHi,
According to your post, my understanding is that you wanted to update the list item in the same sharepoint list with particular condition with Sharepoint Designer 2013.
I recommend to create workflow associated to the list and then start the workflow automatically when an item is changed.
In the workflow, you can add condition and actions as below:
If current item: C equal to Test1
Set E to Test2
Then the value of the filed E will be changed based on the value of the filed C.
In addition, if you create the form using InfoPath, you can add rule to the filed C as below:
Best Regards,
Linda Li
Linda Li
TechNet Community Support -
Since updating to IOS 8.1 on ipad mini can't download apps from iTunes store. Apps show "waiting." Have reset to new condition with no improvement. Also turned off Wi-Fi and re-connected. Any solution? Thanks,
If you restored your iPad as new, and it still didn't help, I don't know if anything in here will help. in any event, I have posted this boilerplate of suggestions many times in the past and the suggestions in here have worked for others at one time or another. Feel free to give them a try.
1. Tap the "waiting" icon and see if you can pause it. If it does pause, then tap it again and see if it will resume. If that works, repeat the same steps for each "waiting" icon.
2. Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
3. Make sure that you do not have a stalled download in iTunes - if you have a download in there that did not finish, complete that one first. If you see a downloads tab in the lower right corner, then there is a download in iTunes.
4. If that doesn't work - sign out of your account, restart the iPad and then sign in again.
Settings>iTunes & App Store>Apple ID. Tap your ID and sign out. Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
Go back to Settings>iTunes & App Store>Sign in and then try to update again. Tap one waiting icon only if necessary to start the download stream.
5. You can also try deleting the waiting icons - tap and hold down on an icon until it wiggles - the tap the X on the icon to delete it. Then try to download again. Apps may also be able to be deleted in Settings>General>Usage>Storage if you cannot get the X to pop up on the icon.
6. You can try resetting all settings. Settings>General>Reset>Reset All Settings. You will have to enter all of your device settings again.... All of the settings in the settings app will have to be re-entered.
7. Reset your router. Unplug it from power for about 30 seconds and then plug it back in again. -
I have this icon on the top right of my screen that is a lock with like a circle and arow around it that wont go away, what does it mean?
Here's the answer:
https://discussions.apple.com/message/15098215#15098215
https://discussions.apple.com/message/15622244#15622244 -
Help with Like Prepared statement
Hi,
Below is a part of the code in my test application which I am using for searching the phone book.
I want to do a pattern search with like, but for some reason, my code is not fetching me the results.
It just gives Zero results.
But if i use "=" it works fine.
I have highlighted the important part
Can you please guide me to correct this code ?
public class DBprgm {
ResultSet result;
public ResultSet getSearch(String a) {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:source", "sa" , "");
Statement st = con.createStatement();
PreparedStatement ps = con.prepareStatement("select from friends where fname like ? ");*
*String x = "%"+a+"%";*
*ps.setString(1, x);*
result = ps.executeQuery();
catch (SQLException s){
s.printStackTrace();
catch (ClassNotFoundException c){
c.printStackTrace();
return result;
}Your code leaks Connections! You create a Connection and never close it, that's a pretty bad idea.
What database are you using? From a quick glance the code seems correct (apart from the problem I mentioned above, of course).
Edit: also, I see that you're using the JDBC-ODBC bridge. That JDBC driver has only very limited functionality and also has a few tiny bugs. Generally I'd strongly suggest that you avoid it and use your databases native JDBC drivers instead. Maybe that's also the problem here, but I can't say for sure. -
Wrong result for query with like and %
I have a strange problem with query with like and %.
When I run this script:
ALTER SESSION SET NLS_SORT = 'BINARY_CI';
ALTER SESSION SET NLS_COMP = 'LINGUISTIC';
-- SELECT * FROM NLS_SESSION_PARAMETERS;
-- drop table test1;
CREATE TABLE TEST1(K1 NVARCHAR2(80));
INSERT INTO TEST1 VALUES ('gsdk');
INSERT INTO TEST1 VALUES ('ąxyz');
INSERT INTO TEST1 VALUES ('ŁFa');
INSERT INTO TEST1 VALUES ('ła');
INSERT INTO TEST1 VALUES ('Śab');
INSERT INTO TEST1 VALUES ('Śrrrb');
commit;
select * from TEST1 where k1 like N'Ł%';
I get this:
K1
ŁFa
ła
Śab <- WRONG
Śrrrb <- WRONG
4 rows selected
When i change datatype to varchar2 this code work correct.
Is this a bug or what ?
The execution plan:
PLAN_TABLE_OUTPUT
SQL_ID d3d64aupz4bb5, child number 2
select * from TEST1 where k1 like N'Ł%'
Plan hash value: 4122059633
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | | | 2 (100)| |
|* 1 | TABLE ACCESS FULL| TEST1 | 1 | 82 | 2 (0)| 00:00:01 |
Predicate Information (identified by operation id):
1 - filter((NLSSORT("K1",'nls_sort=''BINARY_CI''')>=HEXTORAW('014200'
) AND NLSSORT("K1",'nls_sort=''BINARY_CI''')<HEXTORAW('01610100') ))
Note
- dynamic sampling used for this statement (level=2)DATABASE NLS CONFIGURATION:
NLS_CHARACTERSET AL32UTF8
NLS_NCHAR_CHARACTERSET AL16UTF16
NLS_COMP BINARY
NLS_SORT BINARY
Oracle version 11.2.0.2.0 -
Case insensitive selects with 'like'
I use a 10g database (10.2.0.2 same behaviour with 10.2.0.1). What we want is case insensitive selects with 'like' operator in the where clause. NLS_COMP is set to 'LINGUISTIC' and NLS_SORT is set to 'BINARY_CI.
In a table we have two columns one of type 'varchar2' one of type 'nvarchar2'. The databases national character set is set to UTF8. Case insensitive sorting works with both columns. Select statements with '.... where varchar2col like '%r%' returns also values with upper case 'R' values (that is what I expect).
The select statements with '.... where nvarchar2col like '%r%' however does not return the row with upper case 'R' values.
I used SQL*Plus: Release 10.2.0.3.0 and other clients and the behaviour is the same so
I think it is not client related.
Is that a known issue or is there any other parameter to set for UTF8 nvarchar columns?
Any hint is very much appreciated! Here are the nls settings in database, instance and session:
DPARAMETER DVALUE IVALUE SVALUE
NLS_CHARACTERSET WE8ISO8859P1
NLS_COMP BINARY LINGUISTIC LINGUISTIC
NLS_LANGUAGE AMERICAN AMERICAN AMERICAN
NLS_NCHAR_CHARACTERSET UTF8
NLS_RDBMS_VERSION 10.2.0.1.0
NLS_SORT BINARY BINARY_CI BINARY_CI
NLS_TERRITORY AMERICA AMERICA AMERICAOK. Found out what the problem is. It is obviously the client.
While using the instant client and setting the parameters (NLS_SORT=BINARY_CI and NLS_COMP=LINGUISTIC) as environment variables does not work correctly, at least not for nvarchar2 fields. The nls_session_parameters show the correct values, but selects with 'like' operators in the where clause do not return case insensitive. Issuing the 'alter session' commands and again setting the nls parameters solves the problem.
Using the full client installation also works, in case the parameters are set in the registry on windows systems. With the full client it it not necessary to issue the 'alter session' commands again.
So obviously the problem is instant client and nvarchar2 field related. That's too bad.... -
Mandatory Condition with parameters
I am trying to enforce a rule that a date range must be specified whenever querying a particular table. I tried using a mandatory condition with parameters, but it appears that parameters can only be used in workbooks, not in business areas. Have I got this right ? If so, is there any other way the administrator can enforce this rule ?
You are right that parameters are not supported by Discoverer Administrator. But on metalink there are documents on how to accomplish it manually: note 282249.1 and 304192.1
Regards,
Sabine -
Race conditions with UI thread
Hi community,
the update to LabVIEW 2014 has caused sveral of my vis to act up - vis that I had coded with race conditions with the UI thread that I was not aware of.
Maybe they didn't exist previously, maybe I was just ignorant.
Here is a where I first noticed something was wrong. It has a workaround inside:
http://forums.ni.com/t5/LabVIEW/How-to-make-sure-plots-in-xy-graph-are-present/td-p/3033109
Thanks again Norbert for your help with that.
Now problems are showing up in other places too and it might be the tip of an iceberg. I'm a little afraid right now. It's not just xy graphs. The latest example:
I have a sub-vi whose frontpanel I open with an invoke node inside that sub-vi. Afterwards, in the caller I register for events of frontpanel objects of the sub-vi. This fails now - apparently the fp of the sub-vi isn't open yet although the sub-vi has finished executing (yes, I use dataflow to ensure register for event is done only after the sub-vi has finished). This has a striking resemblance to my issue in the previous thread. It seems that vis can now be "finished" executing while stuff that was supposed to happen inside the sub-vi is still executing in the UI thread.
I had not expected this.
Is this intended behaviour?
Is this new to LabVIEW 2014?
Can someone please shed some light on this behavior change (if indeed it is one)?
Can someone please advise me on a general solution/workaround for the host of problems this is causing me?
Best regards
FlorianNorbert,
I'm currently unable to reproduce the issue in my code regardless of cpu core affinity (you gotta hate random errors).
I have attached an example that shows a simplified version of the code that has previously produced the error.
This example might be flawed since it hasn't produced the error yet.
The issue would show when the button "open window" is pressed, if it did at all.
Also there is stuff in there that I just implemented in an attempt to keep the UI thread busy.
For the core of the issue please disregard the bottom while loop in caller.vi
I'll keep trying.
Best regards
Florian
Attachments:
subvi event registration.llb 56 KB -
T code/ report to list all material sales pricing condition with deletion i
I create sales org/ material level pricing conditions in VK11. Some unwanted material pricing conditions are with Deletion indicator active. Iu2019m looking for a report to list all material sales pricing condition with deletion indicator active.
Please advice me on this.Hi Goto v/ld and select 16 which stands for individual prices, and then populate sales organization, distribution channel, customer ,material numbers,etc...and tick "Cond.marked for deletion" check box in "list screen" tab which is the most important, execute you will be able to see all material pricing condition even though it had been deleted.
Maybe you are looking for
-
PDF from postscript (ps2pdf) displays "Insufficient data for an image" error in Reader
Hello, I'm not fully confident this is the best place for this, but I'll start here. Note that this is NOT the same as the issue that was recently fixed in Reader 11 (found at http://helpx.adobe.com/acrobat/kb/insufficient-data-image.html) I am using
-
Every time there is an update for itunes it will not update because it can not find my original MSI file even tho the MSI file is there and I can not uninstall Itunes because of the same MSI file , I have recently done a system restore on my computer
-
Stitching images with overlays
I am stitching one large imaq image from several smaller images using image to image copy. The small images each have several overlays. After the image to image copy the overlays from the small images are lost. How can this be avoided. Or at least
-
Cannot compile Lightspark, problem with llvm
Hello, Lightspark is a new flash player for Flash 9 and more I would like to try. All is done for Ubuntu users, but for the others you have to compile the sources, that's what I am trying. During the compilation, here is what I got : [ 94%] Built tar
-
Transport mass addition to the import queue
I have around 500 transports to be added into import queue after refresh. Now if i add once at a time, it will take a lot of time. Is there a way to add multiple transports at the same time. I know about running multiple transports in a single type