Alternate sequece statement to bring it to initail value
i have created sequence seq_1 and in after running the procedure i want to bring it to zero how should i .when i use this alter statement i am finding errror could u please help it what is the alternate sequece st to bring it to initail value
ALTER SEQUENCE seq_1 MINVALUE 0;
You can either drop and recreate and sequence.
OR
ALTER SEQUENCE seq_1 INCREMENT BY -<max_value_of_sequence>
Similar Messages
-
Procedure to bring the total taxes value
Hi Sapers,
Please provide me procedure to bring the total taxes value of a material to pricing procedure in MM. My client requires this functionality. Client wants to see the total taxes value in P.O. line item conditions.
Thanks in advance
PrasadHi Prasad,
Bringing the tax value to the pricing procedure might be possible, but will certainly not be easy, since this is not the "normal" way of working.
On the other hand, you can see the taxes in the PO if you go to the tag "Invoice" and aside the tax indicator press the pushbutton "Taxes".
Hope I got your requirement right.
BR
Raf -
I have a project whose buttons animate pretty heavily on interaction. So, when you mouse over a button, it increases in scale, and has two states per button – i have figured that out with your help.
My next big question, pertains to the orange buttons found in the "let me" explore section of this site:
www.straightlinenyc.com/introduction/launch.html
If you mouse over the orange buttons (only the ones that pop alone, if they pop with another bubble somewhere, those are the wrong ones) it pops up with the appropriate words inside, as you see, when you click on these, they change to give you a definition of that word, and when you click again it goes back.
I guess my question is, should i use a boolean to accomplish this? the click state change makes sense to me, but the second click is kind of throwing me for a loop.
I just need some help in how to approach these? If i was not clear enough, just let me know, and i will try to be more specific.Ok, as usual I said "great, thanks" too early. I am not quite getting the toggle functionality, so thought I would show you what I am trying to do, and someone could be a dear with the coding? Just watched a lot of tutorials, but not quite there.
My button instance name: btn_disCase
The frame labels I want to reference: clickOne, and clickTwo (these are the frame labels within the moviclip)
So yes, pretty much I want the button to toggle between these frames with the mouse click (while over the mc obviously). So, here was my attempt:
btn_disCase.buttonState = "on";
btn_disCase.addEventListener(MouseEvent.CLICK, disToggle);
function disToggle(e:MouseEvent){
if(e.currentTarget.toggle){
btn_disCase.gotoAndPlay ("clickTwo")
else {
btn_disCase.gotoAndPlay ("clickOne")
e.currentTarget.toggle=!e.currentTarget.toggle;
Obviously, it is pretty flawed, and honestly I am not sure what the ! stands for in your suggestions. Thanks. -
Help with alternate sql statement?
I have the following setup:
create table sc_t1
( n1 number, n2 number, n3 number, constraint sc_t1_pk primary key ( n1 ) );
create table sc_t2
( n1 number, n2 number, primary key ( n1 ) )
organization index;
insert into sc_t1 values ( 1, 2, 1);
insert into sc_t1 values ( 2, 1, 1);
insert into sc_t1 values ( 3, null, null );
insert into sc_t1 values ( 4, null, null );
insert into sc_t2 values ( 1, 11 );
insert into sc_t2 values ( 2, 12 );
insert into sc_t2 values ( 3, 13 );
insert into sc_t2 values ( 5, 15 );
I would like to see the following result:
11 12 11
12 11 11
13
The following query achieves the result, but it joins sc_t2 three times. Is there a way have just one join because tables sc_t1 and sc_t2 will have 1,000,000+ rows.
select b.n2 as r1
, nvl2( a.n2, c.n2,null ) as r2
, nvl2( a.n3, d.n2, null ) as r3
from sc_t1 a
join sc_t2 b on a.n1 = b.n1
join sc_t2 c on nvl( a.n2, a.n1 ) = c.n1
join sc_t2 d on nvl( a.n3, a.n1 ) = d.n1;
I was hoping to pivot the result from the following query, but it returns only two instead of three rows per row in sc_t1:
select a.*
, b.*
, row_number() over ( partition by a.n1 order by a.n1 ) as rn
from sc_t1 a
join sc_t2 b
on a.n1 = b.n1
or nvl( a.n2, a.n1 ) = b.n1
or nvl( a.n3, a.n1 ) = b.n1
/you MUST join it 3 times. if it's slow, make indexes
select b.n2 as r1, c.n2 as r2, d.n2as r3
from sc_t1 a, sc_t2 b, sc_t2 c, sc_t2 d
where a.n1 = b.n1
and a.n2 = c.n1(+)
and a.n3 = d.n1(+) -
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 -
Text Entry Box--Advanced Actions--Conditional Statement--Double quotes in literal input value
Hello forums,
I'm new to the forums (and Captivate in general), but I'm having a real problem carrying out a tutorial design and I think you may be my only hope. Let me explain what I want to do and the difficulty that I'm having:
I'm an instruction librarian at a university, and I'm designing an interactive tutorial for English 100 students to complete in order to become familiar with how to search the library catalog. What I've done is taken a screenshot of the catalog search page, made it the background of a slide in Captivate (vers. 6), and placed a text entry box over the search bar in the screenshot. The idea is for the students to conduct a simulated search by choosing one of three suggested search string formulations, and depending on the search string they enter, the tutorial will jump to a slide featuring a screenshot of what the actual search results would look like. The idea is to emphasize the use of keywords over full-sentence phrases, and the use of double quotation marks to enclose multi-word search terms.
So I've set the action for the TEB to "Execute Advanced Actions" and then created some IF/THEN statements in the "Advanced Actions" pop-up window (with action type set to 'conditional'). The script is such that if the student enters the first search option (how does sleep affect college students) in the TEB, the tutorial jumps to 1 slide, if they enter the second option (college students AND sleep), featuring a Boolean operator (AND), the tutorial jumps to a 2nd slide, and if they enter the third option ("college students" AND sleep) with the double quotes around "college students" and the Boolean operator, the tutorial should jump to a 3rd slide. This action script works fine for the first two input options, but I can't make it work for the third search option.
I think that it has something to do with the fact that the third input option features double quote marks, and this seems to throw off the script (I tried a quote-less input value for the third IF/THEN just to make sure that it would work jumping to the 3rd slide and it did), and I'm wondering if anyone has any suggestions as to how I can get around this issue. Again, I need it to work so that if the student enters "college students" AND sleep, with the quote marks and the Boolean operator, the tutorial will jump to a slide showing the search results if those search terms were used in a real search of the catalog.
I'd be extremely grateful for any help that anyone here can give me, we've been trying to make our online tutorials more engaging and interactive (and therefore more interesting), and I think this would be a great way to teach students about using quotes in their catalog searches.
Thank you for your time and consideration.
Andrew Wilk
College Library
UW-MadisonThe tutorial is for a "how to use catalog searching" instruction in an undergraduate library session. We use boolean operators (AND, OR, NOT) to combine search terms, ex. to search for books about the sleeping habits of college students, I would enter "college students AND sleep." Because "college students" is a multi-word phrase to describe one concept, I need to put quotation marks around the phrase to prevent the catalog from searching for the individual words separately, so the most correct search becomes ["college students" AND sleep] with quotation marks around only "college students," a user-typed "AND," and the word "sleep" (no q-marks).
A colleague of mine worked out a pretty cool (if complicated) solution that I'll share if anyone is interested. Since the q-marks where the problem, we've set it up so that the TEB validates the response for the search string with q-marks around "college students." If they enter it correctly, the tutorial jumps to the corresponding slide. The attempt # is set to 1, and if the user fails to enter the validated phrase (they misspell or use one of the other response options) then the TEB is set to run an Advanced Actions Script in which the other two options are scripted in IF/THEN statements that cause, when the term is entered correctly, the tutorial to jump to their corresponding slides. We've created another tab of IF/THEN statements that say that if the response is NOT equal to one of these response options, then the slide restarts (technically the slide "jumps" back to itself and starts over) and the user gets another chance to start the cycle over again.
I know this is confusing (I had a really hard time explaining it in words), so if anyone is interested I could make a Jing video when I have some time.
Thank you for all your suggestions -
Bringing a list of values from a table in another sheet
Hey everybody - Numbers / Spreasheet novice here working slowly through my project.
So in the first image I've got 2 cells with drop-down menus for "Day of week" and "Hour of day" - Using the both of them causes 1 of the cells in the table below it to print "True"
My goal is to link the "True" statement with a whole bunch of different tables on other sheets.
For example: IF Monday / 8am is "True" > Print the list from Sheet-2::8am
If I want to use the same blank table for "Monday / 9am" and "Monday / 10am" am I going to have to nest 119 separate equations in the same cell?
Is there an easier way to do this?
Thanks!!"All the data is located on tables on separate sheets..."
From your most recent description, it appears that table shown, named 8am, is the only source for the data to fill the table Day/Hour List when the two pop-up menus in the small table are set to Mon and 8am respectively, and that all of the data on 8am is to br copied to Day/Hour List.
Extending that, I would assume that there is a similar source table for each combination of DAY and HOUR, and that setting the two pop-up menu cells determines which of these 105 tables becomes the source table for Day/Hour List.
Since the source table ("8am") does not contain an indication of which day it is for, I'd further assume that this information is included in the Sheet name of the Sheet on which 8am is placed, and that the Sheet names are identical except for the (short) day name.
"My dilemma - how do I write a function for the blank table that would copy the contents of the 27 row long "8am" table into the blank table
How do I make that same function work to do the same thing if say "Tuesday 8am" was "True" instead?"
Why bother? You can see from the small table with the day and hour pop-ups wich day and hour are selected. and it's easier to write the formula retrieving the data using those two values than to use values determined by which cell contains TRUE on a 7x15 table.
Regarding "Mon 8am" and "Tuesday 8am": You will need to decide whether you are using full day names or short day names, then be fully consistent in that use in all instances—Sheet names, pop-up cell menu items, column headers, or any where else they might be needed in formulas.
Does 8am contain "blank" as indicated, or is this an added note to indicate that these are actually empty cells? Do you want Day/Time List to show the text "blank", or to appear 'empty'?
Note that only cells where data is entered directly are likely to be truly 'blank'; there's no way directly available to the user to create a truly empty cell using a formula or a pop-up menu. The closest approximation is a null string, which appears 'empty', but actually contains a zero length string (and a formula).
Here's a possible solution, based on the assumptions above. The first example shows the result with Mon 8am selected. To the right, past the image of part of the sidebar, are images of the tables 8am and 9am from the selected sheet, Mon.
The second example shows the same two tables (on the left), with the settings changed to Tue 9am.
An image of two of the source charts from the Tue sheet are shown to the right of the Sheets list. Note that the Header Row in these is empty. The Header row cell in Day/Time List is filled using the data in the two pop-up menu cells.
Formulas:
Small table (Day Time): none. Header cells are directly entered data. Row 1 cells are pop-up menus.
Day/Time List:
A1: =Day Time :: A2&" "&Day Time :: B
A2, and filled down:
=IF(LEN(OFFSET(INDIRECT(Day Time::$A$2&"::"&Day Time::$B$2&"::$A$1"),ROW()-1,0))<1,"",OFFSET(INDIRECT(Day Time::$A$2&"::"&Day Time::$B$2&"::$A$1"),ROW()-1,0))
The core of this formula is this repeated part: OFFSET(INDIRECT(Day Time::$A$2&"::"&Day Time::$B$2&"::$A$1"),ROW()-1,0)
INDIRECT is used to build an absolute reference to a cell (A1) on the table named in Day Time::B2 on a sheet named in Day Time ::A2.
OFFSET uses the referenced cell as its base, and returns the value from the cell ROW()-1 rows below it and 0 columns to the right.
OFFSET is enclosed in an IF statement: IF(LEN(result of formula)<1,"",result of formula)
In the first instance of OFFSET, the result is passed to LEN(), which measures its length in characters. IF that LEN is less than 1, IF returns a null string to 'my cell'. Otherwise, IF calls OFFSET once again, and the result is returned to 'my cell.'
Expanding the result to a 27 row table requires only adding rows to the Day/Time List table, and filling the formula into those rows.
Regards,
Barry -
Corrupt Session State? - Apex form posts text value as Null
Recently I've discovered an issue with our Apex installation in which any value chosen as a source for a text field ends up being posted as a null to the database.
We are running APEX version 3.2 within an Oracle 10.2.0.4 database using the Oracle HTTP Server from the 10g companion disk.
At first glance, everything appears to function as expected; I have created a simple table called "oracle_sr" with 2 columns both not null:
SQL> desc capacity.oracle_sr
Name Null? Type
ORACLE_SR_ID NOT NULL NUMBER
TIMESTAMP NOT NULL DATE
Within APEX the form wizard was used to create a form on this table.
After executing the pages and entering a value for the timestamp field I can create records without issue.
The issue arises when I choose a source value for the timestamp field.
Any of the source options result in the same error (including a static value) so I will focus on the SQL Query for the source as:
select sysdate from dual;
This should substitute the system date within the timestamp text field when the page is executed.
As expected, the value appears in the text box but when I submit the form to create the record I receive the error:
ORA-01400: cannot insert NULL into ("CAPACITY"."ORACLE_SR"."TIMESTAMP")
I have been working with APEX for quite some time and have successfully used this technique in many applications but just started to see this error over the past few days. What is particularly odd about this message is that default "not null" validations created by the form wizard sees the timestamp filed as having a value. The session state information included below is reporting a value yet the database is throwing the ORA-01400.
Has anyone experienced a similar issue? I've spent a fair amount of time trying to research this issue but cannot seem to find any similar posts.
I have included the debug output from my test page, from what I can see, there does seem to be a value associated with the timestamp filed:
0.00: A C C E P T: Request="CREATE"
0.00: Metadata: Fetch application definition and shortcuts
0.00: NLS: wwv_flow.g_flow_language_derived_from=FLOW_PRIMARY_LANGUAGE: wwv_flow.g_browser_language=en-us
0.00: alter session set nls_language="AMERICAN"
0.00: alter session set nls_territory="AMERICA"
0.00: NLS: CSV charset=WE8MSWIN1252
0.00: ...NLS: Set Decimal separator="."
0.00: ...NLS: Set NLS Group separator=","
0.00: ...NLS: Set date format="DD-MON-RR"
0.01: ...Setting session time_zone to -06:00
0.01: Setting NLS_DATE_FORMAT to application date format: DD-MON-RR
0.01: ...NLS: Set date format="DD-MON-RR"
0.01: Fetch session state from database
0.01: ...Check session 2303701116904676 owner
0.01: Setting NLS_DATE_FORMAT to application date format: DD-MON-RR
0.02: ...NLS: Set date format="DD-MON-RR"
0.02: ...Check for session expiration:
0.02: ...Metadata: Fetch Page, Computation, Process, and Branch
0.02: Session: Fetch session header information
0.02: ...Metadata: Fetch page attributes for application 109, page 50
0.02: ...Validate item page affinity.
0.02: ...Validate hidden_protected items.
0.03: ...Check authorization security schemes
0.03: Session State: Save form items and p_arg_values
0.03: *...Session State: Save Item "P50_ORACLE_SR_ID" newValue="" "escape_on_input="N"*0.03: *...Session State: Save Item "P50_TIMESTAMP" newValue="26-MAY-09" "escape_on_input="N"*
0.03: ...Session State: Save "P0_CURRENT_PERSONNEL_ID" - saving same value: "1"
0.03: ...Session State: Save "P0_OFFSET" - saving same value: "0"
0.03: ...Session State: Save "P0_ACTIVE_WEEK" - saving same value: "24-MAY-09"
0.03: Processing point: ON_SUBMIT_BEFORE_COMPUTATION
0.03: Branch point: BEFORE_COMPUTATION
0.03: Computation point: AFTER_SUBMIT
0.03: Tabs: Perform Branching for Tab Requests
0.03: Branch point: BEFORE_VALIDATION
0.03: Perform validations:
0.03: ...Item Not Null Validation: P50_TIMESTAMP
0.04: Branch point: BEFORE_PROCESSING
0.04: Processing point: AFTER_SUBMIT
0.04: ...Process "Get PK": PLSQL (AFTER_SUBMIT) declare function get_pk return varchar2 is begin for c1 in (select ORACLE_SR_SEQ.nextval next_val from dual) loop return c1.next_val; end loop; end; begin :P50_ORACLE_SR_ID := get_pk; end;
0.04: ...*Session State: Saved Item "P50_ORACLE_SR_ID" New Value="6"*
0.04: ...Process "Process Row of ORACLE_SR": DML_PROCESS_ROW (AFTER_SUBMIT) #OWNER#:ORACLE_SR:P50_ORACLE_SR_ID:ORACLE_SR_ID|IUD
0.04: Show ERROR page...
0.04: Performing rollback...
ORA-01400: cannot insert NULL into ("CAPACITY"."ORACLE_SR"."TIMESTAMP")
Unable to process row of table ORACLE_SR.
Return to application.
Any thoughts would be appreciated.
Thank you,
Justin.If you changed the Source Type of an item from Database Column to something else, then it cannot participate in the Automated Row Fetch/Automatic Row Processing (DML) choreography. You should leave the Source Type as it was and change the item's Default Value to populate it when the ARF process fetches a null for the column.
Scott -
Sql insert statement will fail if the data value has empty line
Hi,
I notice if the insert statement in my .sql file contains data that has new line (enter key), the insert will fail.
For example:
insert into mytable (message)
values ('this is the first line
this is the second line that will cause insert statement to fail
so as this third line');
commit;
How to overcome this?
Please advise.
Thank you.
Message was edited by:
bchurn
Message was edited by:
bchurnIt did not return me any error. What is the error you are receiving ??
SQL> create table mytable (message varchar2(500));
Table created.
SQL> insert into mytable (message)
2 values ('this is the first line
3 this is the second line that will cause insert statement to fail
4 so as this third line');
1 row created.
SQL> @c:\test.txt
1 row created.contents of c:\test.txt
<<
insert into mytable (message)
values ('this is the first line
this is the second line that will cause insert statement to fail
so as this third line');
>> -
Naming the evaluated case statement field with concatenating input variable value
Hi,
I am trying to add the input variable value to case statement evaluated field like below query:
declare @Year varchar(4)
select ProductCode,datepart(mm,Date) MonthValue,
case when datepart(mm,Date) = 1 then sum(Price) else 0 END AS Jan+@Year,
case when datepart(mm,Date) = 2 then sum(Price) else 0 END AS Feb+@Year,
case when datepart(mm,Date) = 3 then sum(Price) else 0 END AS Mar+@Year,
case when datepart(mm,Date) = 4 then sum(Price) else 0 END AS Apr+@Year,
case when datepart(mm,Date) = 5 then sum(Price) else 0 END AS May+@Year,
case when datepart(mm,Date) = 6 then sum(Price) else 0 END AS Jun+@Year,
case when datepart(mm,Date) = 7 then sum(Price) else 0 END AS Jul+@Year,
case when datepart(mm,Date) = 8 then sum(Price) else 0 END AS Aug+@Year,
case when datepart(mm,Date) = 9 then sum(Price) else 0 END AS Sep+@Year,
case when datepart(mm,Date) = 10 then sum(Price) else 0 END AS Oct+@Year,
case when datepart(mm,Date) = 11 then sum(Price) else 0 END AS Nov+@Year,
case when datepart(mm,Date) = 12 then sum(Price) else 0 END AS Dec+@Year
from Sales_Imports where datepart(yyyy,Date) = @Year
group by ProductCode, datepart(mm,Date)
Please help me any other way as this is not working...
Thanks,
Srinicreate table Sales_Imports (ProductCode int, Price int, [date] date)
insert into Sales_Imports values
(1,10,'1/1/2014'),(1,109,'2/1/2014'),(1,10,'1/1/2014'),(1,109,'12/1/2014'),
(2,10,'1/1/2014'),(2,109,'2/1/2014'),(2,10,'10/1/2014'),(2,109,'12/1/2014')
declare @Year varchar(4)='2014'
DECLARE @MaxCount INT, @SQL NVARCHAR(max) ,@i INT;
Set @MaxCount = 12
SET @i = 0;
SET @SQL = '';
WHILE @i < @MaxCount
BEGIN
SET @i = @i + 1;
SELECT @SQL = @Sql + ', SUM(CASE WHEN datepart(mm,[Date]) = ' + cast(@i AS NVARCHAR(10)) + ' THEN Price Else 0 END) AS ' +Left(DateName(month,Dateadd(month,@i-1,0)) ,3)+@Year
END
SET @SQL = N' SELECT ProductCode, datepart(mm,Date) MonthValue ' + @SQL
+ N' FROM Sales_Imports
where datepart(yyyy,Date) ='+ @Year + N'group by ProductCode, datepart(mm,Date)
Order by ProductCode, datepart(mm,Date)';
--PRINT @SQL;
execute (@SQL);
--Or your original one
declare @Year varchar(4)
Set @Year ='2014'
declare @SQL Nvarchar(4000)
SET @SQL=
N' select ProductCode,datepart(mm,Date) MonthValue,
case when datepart(mm,Date) = 1 then sum(Price) else 0 END AS [jan' +@year+'],
case when datepart(mm,Date) = 2 then sum(Price) else 0 END AS [feb' +@year+'],
case when datepart(mm,Date) = 3 then sum(Price) else 0 END AS [Mar'+@year+'],
case when datepart(mm,Date) = 4 then sum(Price) else 0 END AS [Apr'+@year+'],
case when datepart(mm,Date) = 5 then sum(Price) else 0 END AS [May'+@year+'],
case when datepart(mm,Date) = 6 then sum(Price) else 0 END AS [june'+@year+'],
case when datepart(mm,Date) = 7 then sum(Price) else 0 END AS [july'+@year+'],
case when datepart(mm,Date) = 8 then sum(Price) else 0 END AS [Aug'+@year+'],
case when datepart(mm,Date) = 9 then sum(Price) else 0 END AS [Sep'+@year+'],
case when datepart(mm,Date) = 10 then sum(Price) else 0 END AS [Oct'+@year+'],
case when datepart(mm,Date) = 11 then sum(Price) else 0 END AS [Nov'+@year+'],
case when datepart(mm,Date) = 12 then sum(Price) else 0 END AS [Dec'+@year+']
from Sales_Imports where datepart(yyyy,Date) = ' + @Year +N' group by ProductCode, datepart(mm,Date)'
--print @Query
Execute (@SQL)
drop table Sales_Imports -
Prepared SQL statement to test existence of a value in a row
Excuse my ignorance in SQL. I didn't do much in SQL queries or DB design in general, but I'm eager to learn.
Idea behind: I'm traversing a directory tree (Java, jdbc) (depth first) and want to collect all files
in that tree and put the as BLOBS into the database.
To find out whether a file is the same as another file (possibly in a different path) I calculate the md5sum
(not sure whether it is proof against collisions or if I should use SHA-256 or some combination of md5sum + chksum).
Anyway, let the md5sum be the unique value that makes the identity of a file for now.
My problem: Find the jdbc/SQL statements that let me decide whether the file (md5sum) is already stored in a ROW
upon which I can decide to either do the INSERT or mark the existing file as being present in a different path.
I stumbled across the problem in the moment when I first time tried to INSERT a row and got told that
md5sum gotta be unique.
Any ideas for design and query? The code example below is incomplete. Especially what I'm looking for is
how to construct a prepared SQL statement into which I can inject the variable later found (md5sum)
Whether I should do that by COUNT(*) or a different method?
Christoph
Here is my sketchy code (Netbeans project) under construction:
* To change this template, choose Tools | Templates
* and open the template in the editor.
package testsqlite;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.sql.*;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
* @author chris
public class Main {
* @param args the command line arguments
private static Connection conn;
private static String sql="INSERT INTO part(name,md5sum) VALUES (?,?)";
private static PreparedStatement pstmnt,pstmnt_ifexists ;
private static String sql_ifexists="SELECT COUNT(*) FROM part WHERE md5sum=?"; // ???
public static void main(String[] args) throws Exception{
// TODO code application logic here
System.out.println("Testsuite-Collector\n");
String path="c:/usr/local/www/data/testsuite/mandanten/chris/probanden";
File f = new File(path);
Class.forName ("org.sqlite.JDBC");
conn =
DriverManager.getConnection("jdbc:sqlite:c:/users/chris/testsuite/versionen");
Statement stat = conn.createStatement();
pstmnt = conn.prepareStatement(sql);
pstmnt_ifexists = conn.prepareStatement(sql_ifexists);
// process
Traverse(f);
// watch result
ResultSet rs = stat.executeQuery("select * from part;");
while (rs.next()) {
System.out.print("name=" + rs.getString("name") + " ");
System.out.println("md5sum= " + rs.getString("md5sum"));
rs.close();
conn.close();
private static void Traverse(File f) throws IOException {
File[] files = f.listFiles();
for( File file : files) {
if(file.isDirectory()){
Traverse(file);
else {
try {
if(file.length() > 0){
FileInputStream fis = new FileInputStream( file );
String md5 = org.apache.commons.codec.digest.DigestUtils.md5Hex( fis );
System.out.println(file.length() +" " md5"->"+file.getPath());
// check whether md5sum is already existing
pstmnt_ifexists=?????
pstmnt.setString(1, file.getPath());
pstmnt.setString(2, md5);
pstmnt.executeUpdate();
catch (SQLException e) {
System.out.println("SQL error:" e.getMessage()"\n");
}And you seriously think that attempting to insert a record and catching the error of it failing is a good design!?!?I certainly do. I agree with Peter here. You can either test for the existence of the record and insert it if absent, or insert the record willy-nilly and catch the exception. The second option is (a) atomic even without transactions and (b) clearly twice as efficient. Same consideration applies to e.g.
if (!map.containsKey(key))
map.put(key, value);
else
; // it was already thereas opposed to
if (!map.put(key, value)
; // it was already thereand many other situations of this kind, e.g.
try
if (InetAddress.isReachable(ip))
s = new Socket(ip, port);
else
; // host not up
catch (ConnectException exc)
// the host wasn't up during connect
}as opposed to
try
s = new Socket(ip, port);
catch (ConnectException exc)
// host not up
}or
try
if (file.exists())
in = new FileInputStream(file);
else
; // it wasn't there
catch (IOException exc)
// it wasn't there, etc ...
}as opposed to
try
in = new FileInputStream(file);
catch (FileNotFoundException exc)
// it wasn't there
}Slight absence of timing window problems in the cases that detect via exceptions, and considerably simpler code. Phobias about how to use exception handling need to be overcome.
I've also had it seriously argued to me that you shouldn't catch EOFExceptions, merely change the format of your file so you 'know' when one is coming up. Sorry to say that I think this sort of thing is complete rubbish. There is a need for an out of band EOF signal with all the readXXX() methods, and this is it. -
Read Statement with Single key with multiple values
Dear Friends,
In ECC 4.6c, I wrote statement like this.
Read table message with key type = 'E' or 'S'.
if sy-subrc = 0.
Populated the message log to output internal table.
endif.
But when i transported to QA which is ECC 6.0, it is giving error.
Can any one help me in modifying this qurey.
Plse read my question thoroughly and reply me back.
Regards,
Santosh Kumar MHi,
You can't use OR condition with READ table. it is always AND condition.
Here 2 ways for ur problem.
If u want to have just one message in the log then use multiple reads.
READ TABLE message WITH KEY type = 'E'.
If sy-subrc IS INITIAL.
populate log.
ELSE.
READ TABLE message WITH KEY type = 'S'.
If sy-subrc IS INITIAL.
populate log.
ENDIF.
ENDIF.
If u want all messages then u have to loop through and populate the log as sugested by Vijay but
Without exit in loop.(Since u need all the messages)
LOOP AT message into wa WHERE type = 'E' or type = 'S'.
populate log.
ENDLOOP.
Thanks,
Vinod. -
CSS opacity statements seem to strip PNG opacity values. Any way to circumvent?
I noticed it's apparently impossible to make a PNG (with
various levels of
opacity) semi-transparent via the usual channels, listed
below :
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=75);
opacity: 0.75;
-moz-opacity: 0.75;
This trio of CSS statements did a pretty good job of covering
all the usual
bases when it came to making an image partially transparent.
However, as
mentioned above, it seems to force all of the pixels in the
PNG to be
exactly *that* transparent (in this case, 75%).
So if your PNG is a gradient that goes from 100% opaque to 0%
gracefully,
applying the above statements to it will cause it to appear
to become
opaque, as the alpha information is stripped and replaced
with "75%" across
the board.
My question is... is there a way for me to make a PNG image
-- one which has
various levels of opacity in it (like a gradient going from
opaque to
transparent) -- semi-transparent while retaining the
proportionate
individual alpha levels of each pixel?
In other words, if I want the PNG to be 75% opaque when shown
in a specific
situation (like a button that will become 100% opaque on
hover/mouseover),
while the more opaque pixels of the PNG remain more opaque
than the more
transparent ones.
Is this at all do-able?"Michael Fesser" <[email protected]> wrote in message
news:[email protected]...
> .oO(Mike)
>
>>Good idea, although that would double the number of
images.
>
> Not necessarily. You can keep multiple images in the
same file and use
> different CSS background positions to show them. Ian
already suggested
> it, here are actual examples of that technique:
>
>
http://wellstyled.com/css-nopreload-rollovers.html
>
http://www.alistapart.com/articles/sprites/
>
> Micha
Granted, but the amount of data being transfered is the same
as if I'd
doubled the number of images.
All I'm looking to do, really, is have a PNG with a slight
shadow effect
(thus, various levels of opacity in the same image) display
in a 90% opaque
natural state, then switch to 100% opaque on mouseover.
For example :
a {
filter:alpha(opacity=90);
-moz-opacity:0.9;
-khtml-opacity: 0.9;
opacity: 0.9;
a:hover {
filter:alpha(opacity=100);
-moz-opacity:1;
-khtml-opacity: 1;
opacity: 1;
90% is just subtle enough to not make the image pale, but
stil give you a
"light up" effect on mouseover.
In Firefox, no problem. CSS's 90% opacity attribute will make
each pixel in
the PNG *proportionately* more transparent (by 10%). In other
words, opaque
pixels become a bit transparent, while already-transparent
pixels become
even MORE transparent. So to the viewer, the entire image
simply became a
bit more transparent.
But in IE -- even IE7 -- the behavior is completely
different. IE will set
ALL the pixels in the PNG (regardless of how transparent or
opaque they are)
to the value set by the attribute. In this case, all pixels
become exactly
90% opaque, equally, across the board, as if the PNG was a
flat opaque
document to begin with (which it wasn't... it had various
levels of opacity
within the same image).
This means that you can't use PNG to do a traditional a:hover
opacity
effect, unless the PNG had no transparency in it to begin
with (in which
case you'd probably use JPG instead).
I've scoured the web for a possible hack around this
limitation, but not
only did I not find one, I didn't find a single mention of
this behavior in
*any* of the PNG transparency primers, tutorials and blogs
that I've found.
If I could at least find someone who so much as NOTICED this
problem before,
I'd feel a little less crazy. :-) -
How to bring fields with no values into workbook..?
Hi Gurus,
We have a query, which is filtered with some 60 GL Accounts. Some of these GL account has no values or activity since long back. But we need to display it in the report for some reasons. Since it doesnu2019t have any value, its not coming up in the report. Only the accounts with values are coming up.
Is there any way I can bring these accounts in the report with 0 as values...? Any help is highly appreciated.
Thanks
UanHi,
there are two ways:
1) first you update in the infocube all values from gl_account.
=> your data volume grown up very much.
2) in the query you create a structure with all values from gl_account.
Sven -
Financial Statement Generator (FSG) and translated flexfield values
Hello.
Sorry, pressed 'Enter' before completing initial question.
How can I make FSG to take translated 'Description' value of General Ledger flexfield segment (e.g Chinese)?
Maybe you are looking for
-
E-mail forwards and downloads flicker and are slow to download
Never had this problems until last night after I downloaded 4.ob12. When downloads are moved to either side for visibility, it returns to original position and the e-mail also flickers off and on--very disconcerting. I've also had problems when I del
-
How to open an image in popup window?
HI, In my project there is some text and a small picture. I want when I click on this image a window appears with the full picture with only close option. ANy idea !! thanks
-
X-FI Sound Stuttering in Windows 7
I have an X-Fi Extreme Music PCI card and am experiencing weird audio stuttering/looping in Windows 7 RC. I've had similar problems with other creative cards and setups through the years, but this is particularly bad and interferes with gameplay. It
-
Keynote presentation through 'infocus in24' projector via iPad3
Hey all, Am looking for some advice really, I'm pretty new to presentations etc! Firstly, the idea is to do a slideshow as part of my brothers best man wedding speech! I've contacted the place where the dinner is and they've offered to make available
-
I cannot download itunes. I get error messages R6034
I cannot download itunes onto my computer. I get error messages R6034 & 71114